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 created not via a context manager 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.

Release files for diapyr 40

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 40
File Size Uploaded
diapyr-40.tar.gz 9.8 kB Details

Built distribution (wheel)

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

Total release size: 21.2 kB

Release files / diapyr-40.tar.gz

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

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

Download URL diapyr-40-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c204e4046e258f7f0728a69ff67201a1cb6b4d6df7c341749cbb5f2bb3ade449
BLAKE2b-256 checksum
How to use checksums
33f962b6bef151c8411706450fd2c72dbf7368813c84c5cae182231e5dca4181
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.12

Release history Release notifications | RSS feed

42

2 release files

41

2 release files

This release

40 This release

2 release files

39

2 release files

38

2 release files

37

2 release files

36

2 release files

35

2 release files

34

2 release files

33

2 release files

32

2 release files

31

2 release files

30

2 release files

29

2 release files

28

2 release files

27

2 release files

26

2 release files

25

2 release files

24

2 release files

23

2 release files

22

2 release files

21

2 release files

20

2 release files

19

2 release files

18

2 release files

17

2 release files

16

2 release files

15

2 release files

14

2 release files

13

2 release files

12

2 release files

11

2 release files

10

2 release files

9

2 release files

8

2 release files

7

2 release files

6

2 release files

5

2 release files

4

2 release files

3

2 release files

2

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