Skip to content

[Discussion] Entering/Existing Scopes?Β #162

Open
@Enforcer

Description

@Enforcer

Hi, let me start from thanking for the awesome project πŸŽ‰

Recently I was implementing a custom scope and I noticed a need for explicitly demarking beginning and ending of this scope. Mine was similar to flask_injector's RequestScope but could also be used outside web framework context, i.e. in background jobs or CLI commands.

I know injector is heavily inspired by Guice and I noticed in their documentation that their API supports enter and exit methods.

I'd like to start a brainstorming about this concept to either:

  • introduce a new API for entering/exiting a scope - similar to configure, provide empty enter, exit methods to be overriden,
  • expand documentation to give others tips to implement such a thing on their own,
  • other?

BTW, here's my custom scope implementation: https://github.com/Enforcer/clean-architecture/blob/master/auctioning_platform/main/main/modules.py#L21 Basically, it's a copy-pasted ThreadLocalScope with extras.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions