-
Notifications
You must be signed in to change notification settings - Fork 0
Home
======= DecTools, A decorator toolkit =======
Overview
====
The dectools module overcomes some challenges in the Python
decorators. It provides a clear and convenient method for
writing your own decorators. The dectools modules also provides
a library of common decorations for logging and testing your code.
The prebuilt libraries can be used with minimal understanding and
provide immediate benefit to users. The method for writing your
own decorators requires more reading.
Installation
====
Like all packages, installation can be harder. If you do not use
virtualenv, I strongly suggest you start. Virtualenv uses a
private directory of packages and binaries for each project making
it easy to uninstall packages. I recommend you use pip or
easy_install to your packages.
You will need to install the dectools module and Michele Simonyti
Linux
-—
On a Linux System:
$ mkvirtualenv new_project
$ workon new_project
$ easy_install decorator dectools
You should set your $PYTHONPATH to point at these new libaries as necessary.
I am not quite sure what commmands are needed in bash, and your IDE will
require some other command anyway.
Other Operating Systems
-——————————
It should install nicely on other systems, though I have not even tried.
Python version
-—————-
I expect this package works on Python 2.6.x only. I have not attempted to
run in on Python 3.×. The ‘@invariant’ pre-built decorator is a class decorator
which makes it unlikely to work on versions Python 2.5.x and before. If people
care, I can back port the package.
Using the Prebuilt Decorators
=========
You can use the pre-built decorators to handle these problems.
- For Debugging:
- @log()
- @pre() and @post()
- @invariant
Using the decorator constructors
========
To be Written