bazel-contrib / bazel-contrib/rules_python

Allow py_wheel to use analysis phase information for attributes

Ouverte
#3,162 0 commentaires 1 réaction 0 personnes assignées Voir sur GitHub
Langage dominant
Starlark
Étoiles
688
Forks
721
Merge moyen
15 h 7 min
PR mergées (30 j)
76

Description

# 🚀 feature request

### Relevant Rules

`py_wheel`

### Description

When building a wheel with `py_wheel`, some attributes are closely tied to the Python runtime the wheel is intended for. For example, building a wheel with a C extension can require a `python_tag` value that has the python version as part of the abi tag.

Because e.g. `py_wheel.python_tag` takes a string, the only way to pass a value is to use a select() expression to map some condition to a raw string. This is tedious, to say the least. It's also problematic for constructing the `cp39` string -- there's no flag that captures the runtime implementation name ("cp"), so creating a select for this is tough (though, still possible with some tricks, see below).

I _think_ a workaround here is to combine toolchain lookup with FeatureFlagInfo. Have a custom rule look up the toolchain and return e.g. implementation_name in FeatureFlagInfo. Have a config_setting map that to true/false. Have a select() expression map the config setting to e.g. "cp39". Complicated and verbose, but I think it would work.

### Describe the solution you'd like

It'd be better if py_wheel either inferred the values from the toolchain, or provided a way to feed analysis phase information in for value.

The loose idea I have is to have an label attribute that accepts e.g. PyWheelInfo provider, and then users can populate that with what they choose. We'd provide a default impl that did the common thing.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par la règle py_wheel, en vous concentrant sur python_tag et sur les informations de la toolchain de la phase d’analyse décrites ici. Déterminez si l’inférence ou une entrée PyWheelInfo prend mieux en charge les attributs dérivés de l’exécution ; le travail est considéré comme terminé lorsque les utilisateurs peuvent fournir des valeurs telles que le tag d’implémentation/version sans le workaround verbeux actuel avec select().

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
build-system
Type d'issue
Fonctionnalité
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.