Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install pykka-injector

How to install pykka-injector

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install pykka-injector
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
Linux (64-bit)
0.1.1 Available View build log
 
Author
License
MIT
Dependencies
Imports
Lastest release
version 0.1.1 on Jan 9th, 2014
Build status

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()

Subscribe to package updates

Last updated Jan 9th, 2014

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.