`packages` is empty when using a non-pypi.org simple index (e.g. Sonatype Nexus)
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 62/100
Línea de trabajo
Comprueba src/python_inspector/package_data.py en get_pypi_data_from_purl (alrededor de las líneas 65–77), donde se construye la URL de metadatos y los fallos hacen que no se devuelvan datos. Reprodúcelo con los dos comandos python-inspector ... --json-pdt proporcionados (índice predeterminado y una URL de simple-index) para confirmar el comportamiento de packages vacío. Sigue cómo se añaden los metadatos devueltos a la salida y verifica que funciona comprobando con jq '.packages[].name' que hay nombres de paquetes para el índice que no es pypi.org.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Currently the metadata fetch requires the pypi.org-specific JSON API. (See also #260 )
When PYINSP_INDEX_URL points at a non-pypi.org simple index (Sonatype Nexus PyPI in my case), python-inspector resolves dependencies but the packages array in the output is empty - package metadata is never fetched.
For example: PYINSP_INDEX_URL=https://my-nexus-pypi.com/repository/pypi/simple:
root@2ae255f06ad8:/project# python-inspector -p3.13 -rrequirements.txt -olinux --json-pdt /tmp/test.json --verbose
...
retrieve package data from pypi:
retrieved package 'pkg:pypi/[email protected]'
retrieved package 'pkg:pypi/[email protected]'
done!
root@2ae255f06ad8:/project# jq '.packages[].name' /tmp/test.json
# (no output - packages is [])
Note the verbose log claims retrieved package ..., yet packages is empty - the retrieval silently failed.
Without the index (default pypi.org) it works:
root@2ae255f06ad8:/project# env -u PYINSP_INDEX_URL python-inspector -p3.13 -rrequirements.txt -olinux --json-pdt /tmp/test.json --verbose
...
root@2ae255f06ad8:/project# jq '.packages[].name' /tmp/test.json
"cx-oracle"
"redis"
Root cause is the get_pypi_data_from_purl builds the metadata URL from the index base and queries the pypi.org-specific JSON API, then returns None on any non-200:
With a Nexus index this resolves to https://my-nexus-pypi.com/repository/pypi/pypi/redis/2.10.6/json, which 404s - Nexus's PyPI format implements the simple index (PEP 503), not the /pypi/<pkg>/<ver>/json API - so the function bails out and no PackageData is produced.
I initially assumed --use-pypi-json-api was the toggle for this. It doesn't help here: in its default (off) position get_pypi_data_from_purl still unconditionally queries the JSON API, and in the on position the help states --index-url is ignored (i.e. pypi.org), so it can't reach a private index either way.
I'm not sure what the correct approach would be, I feel like --use-pypi-json-api option should be fixed that way we download the selected sdist/wheel and parse its PKG-INFO for License / Home-page / Author / Requires-Dist. The simple index already provides the file list + digests, so the JSON API's urls are largely redundant; its unique value is the rich info block, which PKG-INFO also carries.
While searching for solution I've also stumbled upon PEP 691 https://packaging.python.org/en/latest/specifications/simple-repository-api/#json-based-simple-api-for-python-package-indexes
Which might be better than parsing of PKG-INFO (pkginfo package exists though, so it would be easy)
Either way, would like to hear the maintainers thoughts on that. If it something that should be fixed - I would try.
- Lenguaje dominante
- Python
- Estrellas
- 23
- Forks
- 29
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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 aboutcode-org/python-inspector
-
Add support for pylock.tomlPosiblemente ocupada @Anurag-S1ngh la tomó hace 4 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
aboutcode-org/python-inspector#259 · 1 comentario ·
-
InconsistentCandidate: Pre-Release not allowPosiblemente ocupada @Anurag-S1ngh la tomó hace 4 días. Abiertobug design nice-to-have
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
aboutcode-org/python-inspector#257 · 1 comentario ·
-
Feature request: Mask repository credentials in --verbose outputPosiblemente ocupada @Rajeshwari2857 la tomó hace 5 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 58/100
aboutcode-org/python-inspector#254 · 4 comentarios · 4 reacciones ·
-
Python Inspector version 0.15.0 contains the wrong version stringPosiblemente ocupada @Anurag-S1ngh la tomó hace 4 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 45/100
aboutcode-org/python-inspector#253 · 1 comentario ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 52/100
aboutcode-org/python-inspector#246 · 2 comentarios · 2 reacciones ·
Todos los issues de aboutcode-org/python-inspector
Issues similares
-
app: scripts status: backlog type: documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
netbox-community/netbox-scripts#68 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 91/100
marin-community/marin#10765 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 70/100
flathub/com.unity.UnityHub#230 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Claiming namespace `lang2hong`Abiertonamespace operations
Dificultad 1/5 Menos de una hora Aptitud para principiantes 63/100
EclipseFdn/open-vsx.org#14910 ·
Los mantenedores suelen responder en 1 día