Skip to content

Supporting flake8 extensions #543

Closed
@aignas

Description

@aignas

🚀 Support flake8 extensions when using entry_point macro

Relevant Rules

  • entry_point macro from the pip rules.

Description

As noted in this article, flake8 extension loading requires that the extensions are installed allongside flake8 and are present there at runtime. Current documentation example of flake8 entrypoint access does not cover this usecase. For example, I would like to invoke flake8-bugbear extension. I can install it to the bazel WORKSPACE, but I am not sure how to make it available to the flake8 entrypoint as per instructions in pip.md.

Describe the solution you'd like

As a user of flake8 and rules_python I would like a solution, which would allow me to specify, that a particular entrypoint needs to also have specific deps which I can specify as:

pip_entrypoint(
    name = "flake8",
    entry_point = entry_point("flake8"),
    deps = [
        requirement("flake8-bugbear"),
    ],
)

I assume that this is the very least I would need to do, as this definition of adding packages to a particular entry point's environment needs to be defined somewhere in the WORKSPACE or the BUILD files.

Describe alternatives you've considered

Creating a wrapper myself using flake8.main.cli and adding the extensions to the bazel py_binary dependency list. This is working well enough for now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions