rules_python icon indicating copy to clipboard operation
rules_python copied to clipboard

Supporting flake8 extensions

Open aignas opened this issue 4 years ago • 1 comments

🚀 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.

aignas avatar Oct 04 '21 11:10 aignas

Creating a wrapper myself using ...

Yeah this is what we do as well. I think there's a similar shaped problem with Pytest plugins. We have a py_binary wrapper which can handle the plugin wiring, and can expose this to users via a macro for better UX.

thundergolfer avatar Oct 26 '21 23:10 thundergolfer

This issue has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days. Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_python!

github-actions[bot] avatar Feb 10 '23 22:02 github-actions[bot]

This issue was automatically closed because it went 30 days without a reply since it was labeled "Can Close?"

github-actions[bot] avatar Mar 13 '23 22:03 github-actions[bot]