pote
Python helpers, utils or snippets not worthy of its own repo
pip install poteA collection of battle-tested (well, by me in my projects) Python utilities extracted from real projects. These are practical helpers that solve common problems across data manipulation, callbacks, configuration, display, and widgets.
What is pote?
pote provides utilities that don’t justify their own library but are too useful to keep copying between projects. Each module is focused, well-tested, and designed for immediate use.
Modules
Core Utilities
- basic - Fundamental Python utilities: nested data access (
val_at,vals_at), dict helpers, string utilities, type checking, and more - test - Testing helpers beyond fastcore:
test_raises,test_afail,test_is_not - project - Project setup utilities: global console configuration with Rich theme support
Advanced Features
- callback - Callback system for augmenting objects with side-effects, plus
CollBackfor tracking iteration with callbacks - config - Simple namespace for configuration with context manager for temporary changes
- display - Jupyter display enhancements: Rich integration, collapsible JSON rendering, CSS generation
- widgets - ipywidgets utilities: widget cleanup, async support, blocking input helpers (requires
pip install pote[widgets]) - logger_loguru - Loguru configuration helpers for structured logging with hierarchical indentation (requires
pip install pote[logging])
Quick Start
from pote.basic import val_at, AD, shorten
from pote.callback import CollBack
# Access nested data with dot notation
data = {'user': {'name': 'Alice', 'scores': [10, 20, 30]}}
val_at(data, 'user.scores.1') # 20
# Dict with attribute access
config = AD(debug=True, timeout=30)
config.debug # True
# Track iteration with callbacks
for item in CollBack(range(100)):
process(item)
# Progress tracked automaticallyInstallation
pip install poteDevelopment
These utilities are developed with notebooks using nbdev. Browse the notebooks to see implementation and examples.
Philosophy
- Copy-friendly: See something useful? Copy it with my blessing
- Battle-tested: Extracted from production projects
- Documented through tests: Examples serve as both tests and documentation