Skip to content

Wire the Container while running from a project.scripts entry point #913

@santiago-henao-12

Description

@santiago-henao-12

Hi, I basically picked up this library today and while trying ot set up a working example I ran into this:

Basically if I try to run a entry point registered in the project.scripts table of the pyproject.toml file the wiring doesn't happen. This obviously happens because the code that wires the module is inside a if name == "main" conditional. I thought that maybe I could just wire the container in the code of the module that holds the function I run as entrypoint but started wondering if this would affect the tests given that I read that for tests the recommended approach is to create a container fixture. So I'm a bit lost on what to do.

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