Skip to main content

Description

This project is an Aspect Oriented Programming library for python with reflective concerns.

License Development Status Latest release Supported Python versions Supported Python implementations Download format Build status Code test coverage Downloads Documentation Status Code Health

Installation

pip install b3j0f.aop

Features

  1. Free and unlimited access: no limits to sharing of ideas and knowledges with the license MIT.

  2. Performance:

    • less memory consumption in using the __slots__ class property.

    • less time on (un-)weaving and advice application improvement with binary python encoding and in using constants var in code.

    • (dis/en)abling advices without remove them in using dedicated Advice class.

  3. Easy to use:

    • joinpoint matching with function or regex.

    • distributed programming:

      • interception context sharing in order to ease behaviour sharing between advices.

      • uuid for advice identification in order to ease its use in a distributed context.

    • maintenable with well named variables and functions, comments and few lines.

    • extensible through pythonic code (PEP8), same logic to function code interception and concern modularisation with one module by joinpoint or advice.

    • respect of aspects vocabulary in order to ease its use among AOP users.

    • close to callable python objects in weaving all types of callable elements such as (built-in) functions, (built-in) class, (built-in) methods, callable objects, etc.

    • advices are callable objects.

    • Unit tests for all functions such as examples.

  4. Benchmark:

    • speed execution

Limitations

  • Do not weave advices on readonly instance methods (where class use __slots__ attribute).

Examples

How to change the behaviour of min by max ?

>>> from b3j0f.aop import weave, is_intercepted
>>> double_advice = lambda joinpoint: joinpoint.proceed() * 2
>>> weave(target=min, advices=double_advice)
>>> min(6, 7)
12

How to check if a function is intercepted ?

>>> from b3j0f.aop import is_intercepted
>>> is_intercepted(min)
True

Ok, let’s get back its previous behaviour …

>>> from b3j0f.aop import unweave
>>> unweave(min)
>>> min(6, 7)
6
>>> is_intercepted(min)
False

And with an annotation ?

>>> from b3j0f.aop import weave_on
>>> weave_on(advices=double_advice)(min)
>>> min(6, 7)
12
>>> is_intercepted(min)
True
>>> unweave(min)  # do not forget to unweave if weaving is useless ;)

Enjoy …

State of the art

Related to improving criteria points (1. Free and unlimited access, etc.), a state of the art is provided here.

Library

Url

License

Execution

Use

Benchmark

Compatibility

b3j0f.aop

https://github.com/b3j0f/aop

MIT

4/5

4/5

4/5

4/5 (>=2.6)

pyaspects

http://tinyurl.com/n7ccof5

GPL 2

4/5

2/5

2/5

2/5

aspects

http://tinyurl.com/obp8t2v

LGPL 2.1

2/5

2/5

2/5

2/5

aspect

http://tinyurl.com/lpd87bd

BSD

2/5

1/5

1/5

1/5

spring

http://tinyurl.com/dmkpj3

Apache

4/5

2/5

3/5

2/5

pytilities

http://tinyurl.com/q49ulr5

GPL 3

1/5

1/5

1/5

1/5

pyaspects

weaknesses

  • Not functional approach: Aspect class definition.

  • Side effects: Not close to python API.

  • Not optimized Weaving and Time execution: use classes and generic methods.

  • Not maintenable: poor comments.

  • open-source and use limitations: GPL 2.

  • limited in weave filtering.

aspects

weaknesses

  • open-source and use limitations: LGPL 2.1.

  • more difficulties to understand code with no respect of the AOP vocabulary, packaged into one module.

  • limited in weave filtering.

aspect

strengths

  • invert the AOP in decorating advices with joinpoint instead of weaving advices on joinpoint.

  • open-source and no use limitations: BSD.

weaknesses

  • Simple and functional approach with use of python tools.

  • maintenable: commented in respect of the PEP8.

  • limited in weave filtering.

spring

strengths

  • a very powerful library dedicated to develop strong systems based on component based software engineering.

  • unittests.

  • huge community.

weaknesses

  • require to understand a lot of concepts and install an heavy library before doing a simple interception with AOP concerns.

pytilities

strenghts

  • Very complex and full library for doing aspects and other things.

weaknesses

  • open-source and use limitations: GPL 3.

  • not maintenable: missing documentations and not respect of the PEP8.

  • Executon time is not optimized with several classes used with generic getters without using __slots__. The only one optimization comes from the yield which requires from users to use it in their own advices (which must be a class).

Perspectives

  • wait feedbacks during 6 months before passing it to a stable version.

  • Cython implementation.

Donation

I'm grateful for gifts, but don't have a specific funding goal.

Metadata

Release files for b3j0f.aop 0.8.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distributions (sdists)

Source distribution for b3j0f.aop 0.8.4
File Size Uploaded
b3j0f.aop-0.8.4.zip 40.5 kB Details
b3j0f.aop-0.8.4.tar.gz 22.8 kB Details
b3j0f.aop-0.8.4.tar.bz2 20.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for b3j0f.aop 0.8.4
File Interpreter ABI Platform
b3j0f.aop-0.8.4-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 138.0 kB

Release files / b3j0f.aop-0.8.4.zip

Download URL b3j0f.aop-0.8.4.zip
Size 40.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0fa1fe68f2050eef9cd761243233386ab8da99cc87e1c591852de00a6c1752af
BLAKE2b-256 checksum
How to use checksums
f45fe18a2ca7ea69a74980a9be2b10328e924cb2b42abeae1e04a8075d672f02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / b3j0f.aop-0.8.4.tar.gz

Download URL b3j0f.aop-0.8.4.tar.gz
Size 22.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4d72c6f90232cd4394655716fb31abbb7e513b1a7cffbe9f0100a10dd8f00171
BLAKE2b-256 checksum
How to use checksums
1ee4fb1ec52f387892c0f8603a6ae97b76ecb638001906b1bc4601d52564ba0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / b3j0f.aop-0.8.4.tar.bz2

Download URL b3j0f.aop-0.8.4.tar.bz2
Size 20.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0761130121fd70ed90893cec097d943fea08a60abc0e29912640e55d9eafc1f8
BLAKE2b-256 checksum
How to use checksums
2253260e141bd3288104a583b8a04bfc8d01ac46b526bbd26865a68dc29a3683
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / b3j0f.aop-0.8.4-py2.py3-none-any.whl

Download URL b3j0f.aop-0.8.4-py2.py3-none-any.whl
Size 54.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
33861a053a185de896f40e632fe88f33f1fcad936fd3a884370cb0f68817c793
BLAKE2b-256 checksum
How to use checksums
8af1d519675c048459dcacd961de5eae71a81e4cd5778df51dd8b04372ca6165
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.8.4 This release

4 release files

0.8.3

4 release files

0.8.2

3 release files

0.8.1

3 release files

0.8.0

3 release files

0.7.8

3 release files

0.7.6

3 release files

0.7.5

3 release files

0.7.4

3 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.1

1 release file

0.5.0

1 release file

0.4.6

1 release file

0.4.5

1 release file

0.4.4

1 release file

0.4.3

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.1

1 release file

0.3

1 release file

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page