Python Programming
- Color your console output
- Better (String) Enum in Python, color.py
- Virtual Environment using pyenv
- Server- and Client-side Certificates for Python Programmer
- Design patters examples: singleton, pre-bound method, sentinel
- Cheat sheet: F-Strings Number Formatting
- Handling relative imports
- 5 Ways to Measure Execution Time in Python
Development
- Python project Makefile
- Example of Docker-using your python app
- Example of a systemd service using python venv
Frameworks
To look further:
- Textual and textualize/rich
- jmespath.py to support query just like aws cli does.
External resources
- Google style guide
- Guide to Python project management and packaging
- Python Closures
- Alternatives to named tuples
Modules of Interest
site
> python3 -m site
sys.path = [
'/home/alex/Projects/asokolsky.github.io',
'/usr/lib/python312.zip',
'/usr/lib/python3.12',
'/usr/lib/python3.12/lib-dynload',
'/usr/local/lib/python3.12/dist-packages',
'/usr/lib/python3/dist-packages',
]
USER_BASE: '/home/alex/.local' (exists)
USER_SITE: '/home/alex/.local/lib/python3.12/site-packages' (doesn't exist)
ENABLE_USER_SITE: True
Python 3 Module of the Week
https://pymotw.com/3/
One-liners
URL-decode CLI
echo -n "%21%20" | python3 -c "import sys; from urllib.parse import unquote; print(unquote(sys.stdin.read()));"