py_wheel: support PEP 639 license metadata (License-Expression / License-File)
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 63/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- build-system
Línea de trabajo
Empieza en python/private/py_wheel.bzl, especialmente en el atributo license alrededor de la línea 250 y en la generación de metadatos alrededor de las líneas 422 y 432. Rastrea cómo se empaquetan los extra_distinfo_files existentes, luego implementa los atributos PEP 639 solicitados y asegúrate de que Metadata-Version, License-Expression, License-File y los archivos bajo .dist-info/licenses/ coincidan con el ejemplo del issue, preservando el comportamiento existente.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
🚀 feature request
Relevant Rules
py_wheel (python/private/py_wheel.bzl) — extending an existing rule.
Description
py_wheel cannot produce a wheel whose METADATA conforms to PEP 639, which is now Final.
On main today:
Metadata-Versionis hardcoded to2.1(python/private/py_wheel.bzl:422); the PEP 639 fields require2.4.- The only license-related attribute is the legacy free-text
license(:250), emitted as theLicense:field (:432). PEP 639 deprecates that field. - There is no way to emit
License-Expression, no way to emitLicense-File, and no way to place license texts under<name>-<version>.dist-info/licenses/. - There is no escape hatch for appending arbitrary
METADATAlines either, so this cannot be worked around from aBUILDfile.
The practical impact is that a py_wheel cannot declare its license as an SPDX expression, and cannot ship the license texts of its bundled third-party dependencies in the location PEP 639 defines. For anyone who has to produce auditable license metadata for a redistributed wheel, that is a hard blocker.
Other backends have already moved: setuptools 77.0.0 emits License-Expression, stores License-Files in .dist-info/licenses/, and bumps core metadata to 2.4.
Describe the solution you'd like
Two new attributes on py_wheel:
license_expression(string) — an SPDX license expression, emitted asLicense-Expression.license_files(label-keyed string dict) — license file targets mapped to their destination path relative to.dist-info/licenses/. Each entry emits oneLicense-Fileline and packages the file at that path.
Metadata-Version would be raised to 2.4 only when one of the two is set, so existing users are unaffected and the change stays backwards compatible. license and license_expression would be mutually exclusive, as PEP 639 intends.
py_wheel(
name = "my_wheel",
distribution = "my_package",
version = "1.0.0",
license_expression = "Apache-2.0 AND MIT",
license_files = {
"//:LICENSE": "LICENSE",
"//third_party:some_dep_license.txt": "third_party/some_dep.txt",
},
)
produces:
Metadata-Version: 2.4
Name: my_package
Version: 1.0.0
License-Expression: Apache-2.0 AND MIT
License-File: LICENSE
License-File: third_party/some_dep.txt
with both files packaged under my_package-1.0.0.dist-info/licenses/.
Describe alternatives you've considered
- The legacy
licenseattribute — deprecated by PEP 639, carries no SPDX semantics, and does not package license files at all. extra_distinfo_files— can place files inside.dist-info/, butMetadata-Versionstays2.1and noLicense-Filelines are emitted. The files end up present but undeclared, which is not PEP 639 conformant.- Post-processing the built wheel in a separate rule — means unzipping and rezipping the artifact just to rewrite
METADATA; awkward, and easy to get wrong for reproducibility. - Carrying a local patch to
python/private/py_wheel.bzl— what we do today. It works, but it has to be rebased on everyrules_pythonbump, which is exactly what we would rather not carry.
I have this implemented and working locally and would be glad to send a PR. I need to clear the CLA on my employer's side first, so I am opening the issue now to check whether the approach and the attribute shape are acceptable before going down that route.
- Lenguaje dominante
- Starlark
- Estrellas
- 688
- Forks
- 723
- Merge medio
- 2 d 4 h
- PR fusionados (30 d)
- 38
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de bazel-contrib/rules_python
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
bazel-contrib/rules_python#4201 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
bazel-contrib/rules_python#4164 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
go:embed stdlib_list.txt file in gazelle/python/std_modules.go is missingPosiblemente ocupada @udaya2899 la tomó hace 6 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
bazel-contrib/rules_python#3821 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
bazel-contrib/rules_python#4216 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
bazel-contrib/rules_python#4208 ·
Los mantenedores suelen responder en 1 día
Todos los issues de bazel-contrib/rules_python
Issues similares
-
Make Catch2 optional when `RDK_BUILD_CPP_TESTS=OFF`Posiblemente ocupada @pechersky la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Published hardy-bpa-server image is built without the file-cla featurePosiblemente ocupada @EmbryoSpace la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
ricktaylor/hardy#755 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 6 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
siemens/ix#2867 · 1 comentario ·
Los mantenedores suelen responder en 1 día