bazel-contrib / bazel-contrib/rules_python

Support python_version on modules_mapping and/or gazelle_manifest rule

Abierto
#3,120 4 comentarios 0 reacciones 0 asignados Ver en GitHub
gazelle
Lenguaje dominante
Starlark
Estrellas
688
Forks
721
Merge medio
15 h 7 min
PR fusionados (30 d)
76

Descripción

# 🚀 feature request

### Relevant Rules

* [gazelle_python_manifest](https://github.com/bazel-contrib/rules_python/blob/main/gazelle/manifest/defs.bzl)
* [modules_mapping](https://github.com/bazel-contrib/rules_python/blob/main/gazelle/modules_mapping/def.bzl)

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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con gazelle/manifest/defs.bzl y gazelle/modules_mapping/def.bzl; después, revisa cómo la regla del manifiesto utiliza all_whl_requirements y la configuración de línea de comandos python_version. Se considera terminado cuando cualquiera de las dos reglas acepta la versión de Python solicitada y genera el manifiesto o el mapa de módulos correspondiente sin el indicador de línea de comandos, con un comportamiento que cubra los requisitos condicionados por versión.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
build-system
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.