pykka-injector
pykka-injector is a module uniting Injector (Dependency Injection framework) and Pykka (Python implementation of the actor model). It’s only purpose is to allow you to inject dependencies into Pykka Actors.
Works with:
CPython 2.x >= 2.6, 3.x >= 3.2
PyPy >= 1.9
Platform independent.
Usage example
from injector import inject, Injector, InstanceProvider, Key, singleton
from pykka import ThreadingActor
from pykka_injector import ActorStarter
Config = Key('Config')
class MyActor(ThreadingActor):
@inject(config=Config)
def __init__(self, config, user):
self.config = config
self.user = user
def configure(binder):
binder.bind(
Config,
to=InstanceProvider(dict(environment='dev')),
scope=singleton,
)
if __name__ == '__main__':
injector = Injector(configure)
starter = injector.get(ActorStarter)
actor_ref = starter.start(MyActor, kwargs=dict(user='root'))
actor_proxy = actor_ref.proxy()
print(actor_proxy.config.get(), actor_proxy.user.get())
actor_ref.stop()
Copyright
Copyright (C) 2013 Jakub Stasiak
This source code is licensed under MIT license, see LICENSE file for details.
Metadata
Release files for pykka-injector 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pykka-injector-0.1.1.tar.gz | 2.6 kB | Without provenance | Details for pykka-injector-0.1.1.tar.gz |
Release files / pykka-injector-0.1.1.tar.gz
| Download URL | pykka-injector-0.1.1.tar.gz |
|---|---|
| Size | 2.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6eda161af9be6e4f9548410220350f0c6f36dcc25032b36b130f18e0bf24b7ad
|
|
BLAKE2b-256 checksum How to use checksums |
e55b445c287fc8c1bd373d18d867f7046c2325afa3f37fd079f751ec9a449b79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pykka-injector 0.1.1
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.