Skip to main content

diapyr

Constructor injection for Python.

This README is auto-generated, see project wiki for details.

API

diapyr

DI

Convenience import.

types

Convenience import.

diapyr.diapyr

types
def types(*deptypes, **kwargs)

Declare that the decorated function or method expects args of the given types. Use square brackets to request all instances of a type as a list. Use this kwarg to declare the type of result returned by a factory.

DI Objects

class DI()

add
def add(*objs)

Register the given classes, factories or instances.

all
def all(type)

Return all objects of the given type, instantiating them and collaborators if necessary.

__call__
def __call__(clazz)

Return unique object of the given type, instantiating it and its collaborators if necessary.

join
def join(type)

Add a source to the parent that requests the given type from this container.

discardall
def discardall()

Discard all instances created in the current context. Each instance will have its dispose method called if there is one. Normally this procedure is automatic on context exit, this method is provided for the root context which is never exited.

diapyr.start

diapyr.util

bfs
def bfs(keys)

Breadth-first search starting with the given iterable of keys, intended to be used as a decorator. If a function is decorated it should take an info object and key, and yield subsequent keys. If a class is decorated, a new instance of it is used as info object: The class should have a newdepth method that will be called before each depth, and a process method that takes a key and yields subsequent keys as in the function case. The info object is kept updated with the list of currentkeys, current depth and the set of donekeys. Note that the first currentkeys (depth 0) is exactly the passed in keys iterable, subsequent currentkeys will be non-empty lists. The process function is only invoked for keys that have not yet been processed, i.e. unique keys. When finished the decorated function/class is replaced with the last state of the info object.

setuphacks

getsetupkwargs
def getsetupkwargs(setuppath, fields)

Extract the kwargs passed to setup at the given path (typically some setup.py) that have names in the given fields.

Metadata

Release files for diapyr 39

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

Source distribution (sdist)

Source distribution for diapyr 39
File Size Uploaded Provenance Actions
diapyr-39.tar.gz 9.4 kB Without provenance Details for diapyr-39.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for diapyr 39
File Interpreter ABI Platform Actions
diapyr-39-py3-none-any.whl Python 3 none any Details for diapyr-39-py3-none-any.whl

Total release size: 20.4 kB

Release files / diapyr-39.tar.gz

Download URL diapyr-39.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b9159bf23b8bd0113caf809c16bd095add4c2107da89abd7cbd2bd42b214852e
BLAKE2b-256 checksum
How to use checksums
cdb6baead1ea0956123d82e89b6351c43e43f739d9059ec04f81e0fba709e712
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release files / diapyr-39-py3-none-any.whl

Download URL diapyr-39-py3-none-any.whl
Size 11.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
072bcf2c36f0535ef1a1220e2a8cd462072343790afe8782f0dac7645ced89a1
BLAKE2b-256 checksum
How to use checksums
0292307065cf676ac220c911fc9276bea5cde3434e1267082759527302d0de8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Security for diapyr 39

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

39 This release

2 release files No provenance

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