Skip to content

Support python_version on modules_mapping and/or gazelle_manifest rule #3120

@chrisirhc

Description

@chrisirhc

🚀 feature request

Relevant Rules

Description

When in the middle of working on a Python version upgrade, it's valuable to generate gazelle manifests with different module maps because you the requirements.in may include additional requirements for the new python version:

gradio; python_version >= "3.11"

When running the manifest rule with all_whl_requirements, it'll fail with something like:

No matching wheel for current configuration's Python version.

In order to get the desired behavior, we need to run the gazelle manifest update by specifying a different python version via command line --@rules_python//python/config_settings:python_version=3.11.

Describe the solution you'd like

Adding a `python_version attribute to the manifest or modules_mapping rule, so that we can run it with the expected python_version as needed without a command-line flag.

Describe alternatives you've considered

We currently customize our scripts so that we add the command line flag, but I don't think this is feasible.

Other alternatives:

  • Generate a modules mapping per different environment tag satisfied in the requirements.in . This might be heavy-handed, but could work for all other environment markers beyond python_version . And there's no need to maintain multiple manifest files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    gazelleGazelle plugin related issues

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions