A cookbook for the python developer connoisseur π π πΎ
This project contains a curated collection of convenient utility functions that are useful across many projects. The library extends many of the python builtin modules' functionalities, and is therefore similarly structured.
Below are some highlights of the available modules and their functionality:
strings
: _substitution, character deletion, affix editing, case switching, pluralization, similarity matching, bracket parsing, and more ...lists
: co-sorting, multi-indexing, conditional splitting, deduplication.dicts
sets
: Ordered setsop
: Drop in replacement for the builtinoperator
module with added support for default values. And then some.
iter
: Additional iteration utilities: co-filtering, conditional indexing.
functionals
: Funtional utilities: Factory for creating callables with any signature; partial functions definitions via parameter placeholder syntax.decorators
: Extensible decorators for: Control flow (catching exceptions, fallback values), parameter/return value tracing, line profiling.caching
: Performant functional memoization.
oo
: Cached property decorator (with optional dependencies), property forwarding for nested objects, constructors for objects employing__slots__
, context manager for temporary attribute setting.meta
: Tools for building classes, function tagging.
api
synonyms
: Intelligent parameter name autocorrect decorator for building flexible APIs.
pprint
: pretty printing!logging
: logging mixin for explicitly tracing class functionality.
io
: File tree iteration, context managers for safe input/output with file backups, flexible (de)serialization wrappers.
introspect
: Inspect python objects.imports
: Refactor (sort, merge, split, relativize, (de)localize etc.) import statements in python source code.
transforms
: Transforms to and from Cartesian, Spherical, Cylindrical coordinates.
python -m pip install https://github.com/astromancer/recipes
The test suite
contains further examples of how
recipes
can be used. Testing is done with pytest
:
pytest recipes
Contributions are welcome!
- Fork it!
- Create your feature branch
git checkout -b feature/rad
- Commit your changes
git commit -am 'Add some cool feature π'
- Push to the branch
git push origin feature/rad
- Create a new Pull Request
- e-mail: [email protected]
- see LICENSE