
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
aspectlib
Advanced tools
``aspectlib`` is an aspect-oriented programming, monkey-patch and decorators library. It is useful when changing
aspectlib is an aspect-oriented programming, monkey-patch and decorators library. It is useful when changing
behavior in existing code is desired. It includes tools for debugging and testing: simple mock/record and a complete
capture/replay framework.
::
pip install aspectlib
You can also install the in-development version with::
pip install https://github.com/ionelmc/python-aspectlib/archive/main.zip
Docs are hosted at readthedocs.org: python-aspectlib docs <http://python-aspectlib.readthedocs.org/en/latest/>_.
Weaving functions, methods, instances and classes is completed.
Pending:
docs/todo.rst)If aspectlib.weave doesn't work for your scenario please report a bug!
:OS: Any :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).
function_trace <https://github.com/RedHatQE/function_trace>_ - extremely simple#19 <https://github.com/ionelmc/python-aspectlib/pull/19>_.v1.5.0.weave to stop reading attributes that don't match the method selector.
Contributed by Jonas Maurus in #14 <https://github.com/ionelmc/python-aspectlib/pull/14>_.async def functions and generators).weave fixture for pytest.ABSOLUTELLY_ALL_METHODS name (now ABSOLUTELY_ALL_METHODS). Old name is still there for
backwards compatibility.Proceed was yielded.messages property to aspectlib.test.LogCapture. Change call to have level name instead of number.__logged__ wrapper from aspectlib.debug.log decorator.Replay.__exit__ if there would be an error (makes original cause hard to debug).ASPECTLIB_DEBUG for every logger in aspectlib.bind option to aspectlib.Aspect so you can access the cutpoint from the advisor.aspectlib.test.Replay with extraction of context variables (locals and globals
from the calling aspectlib.test.Story). Works better than the previous inference of module from AST of the
result.aspectlib.test.Story.diff,
aspectlib.test.Story.unexpected and aspectlib.test.Story.missing.aspectlib.test.Story.actual and aspectlib.test.Story.expected.ASPECTLIB_DEBUG environment variable option to switch on debug logging in aspectlib's internals.aspectlib.test.Story to keep call ordering, to allow dependencies and improved the
serialization (used in the diffs and the missing/unexpected lists).Changed aspectlib.test.record:
history option to calls.call option to iscalled.callback option.extended option.Changed aspectlib.weave:
Added aspectlib.test.Story class for capture-replay and stub/mock testing.
aspectlib.debug.log to use aspectlib.Aspect and work as expected with coroutines or generators.aspectlib.debug.log to work on Python 3.4.aspectlib.Yield advice. It was only usable when decorating generators.aspectlib.Aspect.aspectlib.debug.log that would inadvertently call __bool__/__nonzero.Changed aspectlib.debug.log:
arguments to call_args.arguments_repr to call_args_repr.call option.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.
Changed aspectlib.weave:
only_methods, skip_methods, skip_magicmethods options with methods.on_init option to lazy.aliases option.skip_subclasses option with subclasses.Fixed weaving methods from a string target.
???FAQs
``aspectlib`` is an aspect-oriented programming, monkey-patch and decorators library. It is useful when changing
We found that aspectlib demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.