Skip to main content

A useful collection of decorators (focused in animation)

Project description

Decorating: A Meta Repo To Decorators

Build Status codecov Requirements Status PyPi version PyPI pyversions PyPI status HitCount

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 animation

Well

Using with nested context-managers context-manager

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:

asciicast

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

PyPi License

MIT

Because good things need to be free.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

decorating-0.5.2.tar.gz (15.9 kB view hashes)

Uploaded Source

Built Distribution

decorating-0.5.2-py3-none-any.whl (18.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page