A useful collection of decorators (focused in animation)
This project encourages an exploration into the limits of decorators in Python. While decorators might by new to beginners, they are an extremely useful feature of the language. They can be similar to Lisp Macros, but without changes to the AST. Great decorators from this packages are @animated and @writing. This repository is made from scratch, just using Python’s Standard Library, no dependency!
Using as decorator and mixed with context-managers
Using with nested context-managers
Another project mine called MAL uses the decorating package —- basically a command line interface for MyAnimeList. The decorator @writing can be used by just adding 3 lines of code! The behavior is a retro typing-like computer. Check out the awesome effect:
More examples are covered on my personal blog post about decorating.
Decorators & Usage
Currently public decorators on the API of decorators decorating:
Mostly decorators has a pretty consistent usage, but for now only animated and writing has support to use as contextmanagers using the with syntax.
Supported Python versions:
You can install the last release on PyPI by calling:
pip install --user decorating
If you want get the last development version install directly by the git repository:
pip install --user git+https://www.github.com/ryukinix/decorating
We have a published package on Arch Linux,which you can install using your favorite AUR Helper, like pacaur or yaourt:
yaourt -S python-decorating
Though since the version 0.6 we have support for Python2.7, an AUR package for Python2 was not made yet. Fill a issue if you have interest on that :). Thanks to Maxim Kuznetsov which implemented the necessary changes to make compatible with Python2!
Because good things need to be free.
Release history Release notifications
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size & hash SHA256 hash help||File type||Python version||Upload date|
|decorating-0.6.1-py3-none-any.whl (19.8 kB) Copy SHA256 hash SHA256||Wheel||3.6|
|decorating-0.6.1.tar.gz (26.5 kB) Copy SHA256 hash SHA256||Source||None|