Skip to main content

dependency helper

Supported Python Versions PyPI version

Dependency helper for properties of python class

$ pip install deps_helper

from deps_helper import Dependencies


class A(deps := Dependencies.new()):
    @deps.register(_for="operation")
    def requested_by(self, user):
        print(f"operation requested by {user}.")

        return f"requested by {user}"

    @deps.register(_for=["check_validity", "operation"])
    def validity(*_):
        ...

    @deps.guard()
    def operation(self):
        print("execute operation...")

    @deps.guard()
    def check_validity(self):
        if self.validity:
            print("Ok")


>>> a = A()
>>> a.check_validity()
Traceback (most recent call last):
...
AttributeError: ("follow attributes are not assigned for check_validity => ", [validity])
>>> a.operation()
Traceback (most recent call last):
...
AttributeError: ("follow attributes are not assigned for operation => ", [requested_by, validity])
>>> a.validity = True
>>> a.check_validity()
Ok
>>> a.requested_by = "admin"
operation requested by admin.
>>> a.operation()
execute operation...
>>> print(a.requested_by)
requested by admin
>>>

Metadata

Release files for deps-helper 0.1.6

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

Source distribution (sdist)

Source distribution for deps-helper 0.1.6
File Size Uploaded
deps_helper-0.1.6.tar.gz 1.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for deps-helper 0.1.6
File Interpreter ABI Platform
deps_helper-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 3.4 kB

Release files / deps_helper-0.1.6.tar.gz

Download URL deps_helper-0.1.6.tar.gz
Size 1.8 kB
Tags Source
SHA-256 checksum
How to use checksums
280611901e41730ffd49f6ff9c0048a47d3713349a8317e6c5a95755490454e7
BLAKE2b-256 checksum
How to use checksums
109c4cd7e5135f06718c594c8e9adc2f247e892ce9e4e54be71ae1b0f3b1abbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.9.9 Darwin/21.4.0

Release files / deps_helper-0.1.6-py3-none-any.whl

Download URL deps_helper-0.1.6-py3-none-any.whl
Size 1.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97849a25e118b8df30f263d883ef7b8a022678b7b463db12782830da12583e7f
BLAKE2b-256 checksum
How to use checksums
a5f0e983537ebe8341868d20f7fdaf34e7bbe6bd538c23dae568bd70206148d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.13 CPython/3.9.9 Darwin/21.4.0

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

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