Aspect-Oriented Programming toolkit.
Table of Contents
aspectlib is an aspect-oriented programming, monkey-patch and decorators library. It is useful when changing behavior in existing code is desired.
Weaving functions, methods, instances and classes is completed.
- Whole-module weaving
- Concerns (see docs/todo.rst)
If aspectlib.weave doesn’t work for your scenario please report a bug !
|Runtime:||Python 2.6, 2.7, 3.3, 3.4 or PyPy|
Python 3.2, 3.1 and 3.0 are NOT supported (some objects are too crippled).
- Use simpler import for the py3support.
- Change aspectlib.debug.log to use aspectlib.Aspect and work as expected with coroutines or generators.
- Fixed aspectlib.debug.log to work on Python 3.4.
- Remove the undocumented aspectlib.Yield advice. It was only usable when decorating generators.
- Add support for decorating generators and coroutines in aspectlib.Aspect.
- Made aspectlib raise better exceptions.
- Fix checks inside aspectlib.debug.log that would inadvertently call __bool__/__nonzero.
- Don’t include __getattribute__ in ALL_METHODS - it’s too dangerous dangerous dangerous dangerous dangerous dangerous … ;)
- Do a more reliable check for old-style classes in debug.log
- When weaving a class don’t weave attributes that are callable but are not actually routines (functions, methods etc)
- Renamed arguments to call_args.
- Renamed arguments_repr to call_args_repr.
- Added call option.
- Fixed issue with logging from old-style methods (object name was a generic “instance”).
Fixed issues with weaving some types of builtin methods.
Allow to apply multiple aspects at the same time.
Validate string targets before weaving. aspectlib.weave('mod.invalid name', aspect) now gives a clear error (invalid name is not a valid identifier)
Various documentation improvements and examples.
- Remove junk from 0.4.0’s source distribution.
- Replaced only_methods, skip_methods, skip_magicmethods options with methods.
- Renamed on_init option to lazy.
- Added aliases option.
- Replaced skip_subclasses option with subclasses.
Fixed weaving methods from a string target.