Sometimes you have these simple Python projects that are essentially just a single file.
On the road to package your project "properly",
you'll find a lot of documentation and tools
pushing you towards a complex project layout with multiple folders
(e.g. a generally recommended src
layout)
and additional (empty …
-
-
Automatic JSON-formatted dictionaries in IPython/Jupyter
IPython/Jupyter notebooks have built-in "pretty" formatting of dictionary (and related) constructs. For example, take this messy, nested dictionary construct:
Programmatically creating clients and users in Keycloak
How to create clients and users programmatically in Keycloak, using Python.
Bunch o' cheat sheets
You're probably very familiar with the tools you use daily and operate them from muscle memory. But there are also these setup or maintenance tasks you only do every X months and their practical details are a bit hazy.
This is a random, work-in-progress collection of cheat sheets for these …
Disable pytest's log/print capturing
Yet another solution to dig you out of a circular import hole in Python
The circular import problem in Python. Some module
foo
imports modulebar
, butbar
also importsfoo
. On itself, it's not necessarily a problem. Python allows it. Depending on how both modules interact, you might not even notice there is cycle in the dependency chain.However, when you have a …
Step by Step OAuth 2.0 Authorization Code Flow with PKCE
In this notebook, I will dive into the OAuth 2.0 Authorization Code flow with PKCE step by step in Python, using a local Keycloak setup as authorization provider. The focus lies on practical, step by step low-level HTTP operations. We wont even use an actual browser nor need an actual HTTP server for the redirect URL.
Open a source file from web page with PyCharm protocol handler
When developing a web application of non-trivial size it can be challenging to find the relevant source file or class that is responsible for something you see on a web page.
PyCharm (currently my main development environment for python) provides a
pycharm://
protocol handler, which makes it possible to link …Get stacktrace in Python catch body
So you have some Python code in a try-catch, and you want the typical Python stacktrace (aka traceback, aka backtrace) in a way you can manipulate?
Here are some ways to handle it:
import traceback import logging try: stuff() except Exception: # Just print traceback print "something went wrong, here is …
Check iTunes library for inexistent files and broken links with Python and PyObjC
Music files come, music files go. And after some time your iTunes library is sprinkled with cases of
The song “Monsieur Cannibale” could not be used because the original file could not be found. Would you like to locate it?
Being annoyed by this and having no idea how "healthy …
page 1 / 3 next »