bazel-contrib / bazel-contrib/rules_python

importlib.metadata.files() doesn't work because RECORD is missing

Abierto
#3,024 9 comentarios 0 reacciones 0 asignados Ver en GitHub
type: bug type: pip
Lenguaje dominante
Starlark
Estrellas
688
Forks
721
Merge medio
15 h 7 min
PR fusionados (30 d)
76

Descripción

It appears that `importlib.metadata.files()` is broken with the pypi integration because the RECORD file gets ommited.

Per docs at https://docs.python.org/3/library/importlib.metadata.html#distribution-files

> In the case where the metadata file listing files (RECORD or SOURCES.txt) is missing, files() will return

This came to my attention via @mering trying to use the rtree package, which tries to use its distribution metadata to find some C libraries to load.

Excluding RECORD seems somewhat intentional, though? The code has this comment:

https://github.com/bazel-contrib/rules_python/blob/main/python/private/pypi/whl_library_targets.bzl#L315-L318

> RECORD is known to contain sha256 checksums of files which might include the checksums
> of generated files produced when wheels are installed. The file is ignored to avoid
> Bazel caching issues.

What's the caching issue, exactly? For a downloaded whl, what generated files is it referring to? If a whl is built at repo time from an sdist, then files shouldn't be changing, and the hash should be stable, so how does a cache issue come up?

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Start with the RECORD omission comment in python/private/pypi/whl_library_targets.bzl around lines 315-318, then compare it with the importlib.metadata.files() documentation and the rtree use case described here. Determine the caching concern and whether the PyPI integration should preserve RECORD so files() works; done means the behavior and resolution are documented or implemented with validation.

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
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Tranquilo
Claridad
Necesita aclaración
Aptitud para principiantes
42/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.