Skip to main content

Glorpen IOC Container

https://travis-ci.org/glorpen/glorpen-di.svg?branch=master https://readthedocs.org/projects/glorpen-di/badge/?version=latest

Another Dependency Injection library for Python.

This package has following three guidelines:

  • any class configured by Container mechanism should not be modified in any way

  • there is no need for external services definition files for Container

  • no Container compiling and service tagging - we have introspection and dynamic language for this task

And so this package provides:

  • no xml configuration

  • no annotations (more cons than pros)

  • no changes to services code

Official repositories

For forking and other funnies.

BitBucket: https://bitbucket.org/glorpen/glorpen-di

GitHub: https://github.com/glorpen/glorpen-di

Supported design patterns

Service instance can be created by:

  • factory service

  • calling class object with arguments

Instance options can be altered by:

  • constructor arguments

  • setters

  • calling methods

  • using configurator service

Each service has defined scope, service cannot request other service from narrower scope.

Injecting services and parameters

from glorpen.di import Container

class MyParamService(object):
    pass

class MyService(object):
    def __init__(self, obj, text, value):
        super(MyService, self).__init__()
        print("service instance: %s" % obj)
        print("container parameter: %s" % text)
        print("provided value: %s" % value)

c = Container()

c.add_service(MyParamService)
c.add_parameter('my-param', "value from container")
c.add_service(MyService).kwargs(obj__svc=MyParamService, text__param="my-param", value="defined value")

c.get(MyService)

Running snippet will print:

service instance: <__main__.MyParamService object at 0x7f2fef6e9828>
container parameter: value from container
provided value: defined value

See https://glorpen-di.readthedocs.io/en/latest/ for code examples and more documentation.

Metadata

Release files for glorpen-di 1.5.0

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

Source distribution (sdist)

Source distribution for glorpen-di 1.5.0
File Size Uploaded Provenance Actions
glorpen-di-1.5.0.tar.gz 7.1 kB Without provenance Details for glorpen-di-1.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for glorpen-di 1.5.0
File Interpreter ABI Platform Actions
glorpen_di-1.5.0-py2.py3-none-any.whl Python 3, Python 2 none any Details for glorpen_di-1.5.0-py2.py3-none-any.whl

Total release size: 15.7 kB

Release files / glorpen-di-1.5.0.tar.gz

Download URL glorpen-di-1.5.0.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
326faf42ff7f680874f8c05030b37211f99479f0657565b861849d1dea91c98e
BLAKE2b-256 checksum
How to use checksums
610ec5ef1ade094da834c053b6252c173a18fb9681240fc79b34b3ff9ffb7113
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

Release files / glorpen_di-1.5.0-py2.py3-none-any.whl

Download URL glorpen_di-1.5.0-py2.py3-none-any.whl
Size 8.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a887ada64799f19d3ecadd976c5ff929bbeabf82950176a58e17157574e37b44
BLAKE2b-256 checksum
How to use checksums
3b48428ab08f8d82d7e8a7f752effcc3a5976aef29a12c759e0afe37f8e3cb15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

Security for glorpen-di 1.5.0

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.

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