Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registration/Reset via Decorators #32

Closed
BenjamenMeyer opened this issue Apr 29, 2015 · 2 comments
Closed

Registration/Reset via Decorators #32

BenjamenMeyer opened this issue Apr 29, 2015 · 2 comments

Comments

@BenjamenMeyer
Copy link
Member

Enable something like the following:

@stackinabox.register(HelloService(), MyOtherService())
def my_test(...)
     ...

or

def services()
    a = my_service_a()
    b = my_dependent_service(a)
    return [a, b]

@stackinabox.register(services())
def my_test(...)
    ...

In the first case, multiple services could be easily added if they were not interdependent on each other.
In the second case, the function can setup interdependent services that utilize each other and return them as a group to be registered in a single call.

@BenjamenMeyer
Copy link
Member Author

#45 enables the first case in the description; it also provides the ability for the test function to get access to the services via dictionary provided as a keyword parameter. Theoretically the test function should then be able to inter-connect the services as necessary.

I'll have to think about adding detection of the second portion - essentially, analyzing the *args or **kwars for an iterable object, and then ensuring that everything in the iterable is an instance of StackInABoxService, only then could the iterable be consumed as the services.

@BenjamenMeyer
Copy link
Member Author

PR #56 adds support for generators and iterable objectss so I think we can close this out now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant