bazel-contrib / bazel-contrib/rules_python
importlib.metadata.files() doesn't work because RECORD is missing
- Langage dominant
- Starlark
- Étoiles
- 688
- Forks
- 721
- Merge moyen
- 15 h 7 min
- PR mergées (30 j)
- 76
Description
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?
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par le commentaire sur l’omission de RECORD dans python/private/pypi/whl_library_targets.bzl, vers les lignes 315-318, puis comparez-le à la documentation de importlib.metadata.files() et au cas d’utilisation de rtree décrit ici. Déterminez le problème de mise en cache et si l’intégration PyPI doit préserver RECORD pour que files() fonctionne ; le travail est considéré comme terminé lorsque le comportement et la résolution sont documentés ou implémentés avec validation.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- build-system
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Calme
- Clarté
- À clarifier
- Accessibilité débutants
- 42/100