Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow to specific python_version in gazelle generated py_binary and py_test rules #2749

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

Open
SuperBo opened this issue Apr 7, 2025 · 2 comments
Labels
gazelle Gazelle plugin related issues type: feature request

Comments

@SuperBo
Copy link

SuperBo commented Apr 7, 2025

πŸš€ feature request

Relevant Rules

Description

Currently I am using bazel and gazelle to manage a mono repo with multiple python projects.

Some of them using python 3.10 and others are using python 3.11.

When using gazelle with rules_python, I need to manually append python_version=3.11 to generated py_test rule.

For example

# generated by gazelle

py_test(
    name = "test_module_a",
    srcs = ["module-a/tests/test_module_a.py"],
    python_version = "3.11", # manually edit line
    deps = [
        "//module-a/src/module_a"
    ],
)

Describe the solution you'd like

We should have a new directive such as gazelle:python_version to allow user to override python_version attribute in generated py_test and py_binary rules.

Describe alternatives you've considered

Gemini also suggested to use a build_arg to override default generated rules but it doesn't work.

@aignas
Copy link
Collaborator

aignas commented Apr 7, 2025

A new directive makes sense. feel free to create a PR for this ;)

@aignas aignas added gazelle Gazelle plugin related issues type: feature request labels Apr 7, 2025
@mattem
Copy link
Contributor

mattem commented Apr 8, 2025

We have this in our internal version of the extension that I'm trying to upstream more of, I can include this in that effort if there's interest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gazelle Gazelle plugin related issues type: feature request
Projects
None yet
Development

No branches or pull requests

3 participants