Skip to main content

A bag of objects for Python

https://img.shields.io/pypi/v/pytel-inject.svg?style=flat https://travis-ci.com/mattesilver/pytel.svg https://codecov.io/gh/mattesilver/pytel/branch/master/graph/badge.svg

For when your object graph is too big

class A:
    def __init__(self, b: B):
        self.b = b

class B:
    pass

svc = {
    'a': A,
    'b': B,
}
context = Pytel(svc)
assert context.a.b == context.b

See usage for more cases

Features

  • Build a graph of objects based on init methods or factory functions

  • Initialize from
    • a dictionary of string to any of:
      • callable

      • type

      • value

    • Object containing any of:
      • object fields with objects or types (or callables)

      • class fields with objects or types (or callables)

      • methods

      • static methods

    • An Iterable of the above

  • Verify integrity of the dependency graph using type annotations

  • Recurrently resolve all dependencies at the first reference

  • Works as a Context Manager, on __exit__ close all objects that are Context Managers

Because of strict type checking this package is probably quite unpythonic.

Release files for pytel-inject 0.5.1

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

Source distribution (sdist)

Source distribution for pytel-inject 0.5.1
File Size Uploaded
pytel-inject-0.5.1.tar.gz 8.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytel-inject 0.5.1
File Interpreter ABI Platform
pytel_inject-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.3 kB

Release files / pytel-inject-0.5.1.tar.gz

Download URL pytel-inject-0.5.1.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f876ab7155e8f7d480dd626ba20946ab21e7d7c4bd1284d547c340ae4e35da4b
BLAKE2b-256 checksum
How to use checksums
6444e5555d2973f9aef6c3d51f6002ef6f42772fdcfde4ce8145ab18abee0dc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.7.6 Linux/5.0.0-1031-gcp

Release files / pytel_inject-0.5.1-py3-none-any.whl

Download URL pytel_inject-0.5.1-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
52c960b07f9dfadcacc190a22328100c3b0011a0eba67e46894c08d81a1df925
BLAKE2b-256 checksum
How to use checksums
5476db2389715168e7c881b50681c6abbd4c650d58504331d69e1da712f62cbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.7.6 Linux/5.0.0-1031-gcp

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.5

2 release files

0.4

2 release files

0.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

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