A useful collection of decorators (focused in animation)
Project description
Decorating: A Meta Repo To Decorators
Abstract
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. Famous decorator examples are @animated and @writing. This repository is made from scratch, just using Python’s Standard Library, no dependency!
Installation
INFO: we need some people to do support for Python2, only Python3 for now. Check #3
stable: last release: sudo pip install decorating
bleeding-edge: sudo pip install git+https://www.github.com/ryukinix/decorating
Usage
Public decorators on the API of decorators decorating:
debug
cache
counter
count_time
animated
writing
Examples
Animated
Using as decorator and mixed with context-managers
Well
Using with nested context-managers
Writing
Another project of mine called MAL which is a basic command line interface for MyAnimeList. The decorator @writing can be used by just adding 3 lines of code! Check out the awesome effect:
Developers
sudo git clone https://www.github.com/ryukinix/decorating
cd decorating
sudo make develop
The develop mode creates a .egg-info (egg-link) as a symlink in your standard site-packages/dist-packages directory. Don’t worry with the decorating.egg-info, it’s only information for the package egg to link with your PYTHONPATH. For that, the usage is dynamic, you can modify the code in test on the command line always using absolute imports in anywhere (like the first example)
Contributing
Please make sure the code passes lint and tests before sending a pull request. You can set up pre-commit to make this easy.
In the root of git repository, run these commands after cloning the project:
sudo pip install pre-commit pylint nose2 pre-commit install
If you don’t know about pre-commit, check the pre-commit website.
Now you can create a new branch git checkout -b feature based on the master (or other you want to improve, like dev) and send a pull-request to me!
If you just want to know something or give me a suggestion, create a new issue!
License
MIT
Because good things need to be free.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for decorating-0.5.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84fb6734ba43652d31fbad811375a66e54d5e448277f5e1d2d83509133a22190 |
|
MD5 | a21852628f54a0b54db0347f5687f8dc |
|
BLAKE2b-256 | 29c6b7cdab6b0847342ae8512f3df7f244aae521f133d9f23189de3cbe861b61 |