`packages` is empty when using a non-pypi.org simple index (e.g. Sonatype Nexus)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 62/100
Hướng nghiên cứu
Kiểm tra src/python_inspector/package_data.py trong get_pypi_data_from_purl (khoảng dòng 65–77), nơi URL siêu dữ liệu được tạo và các lỗi khiến không có dữ liệu nào được trả về. Tái hiện bằng hai lệnh python-inspector ... --json-pdt được cung cấp (chỉ mục mặc định và một URL simple-index) để xác nhận hành vi packages rỗng. Theo dõi cách siêu dữ liệu được trả về được thêm vào đầu ra và xác minh thành công bằng cách kiểm tra với jq '.packages[].name' rằng có tên gói cho chỉ mục không phải pypi.org.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 23
- Fork
- 29
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aboutcode-org/python-inspector
-
Add support for pylock.tomlCó thể đã có người làm @Anurag-S1ngh đã nhận 4 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
aboutcode-org/python-inspector#259 · 1 bình luận ·
-
InconsistentCandidate: Pre-Release not allowCó thể đã có người làm @Anurag-S1ngh đã nhận 4 ngày trước. Đang mởbug design nice-to-have
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
aboutcode-org/python-inspector#257 · 1 bình luận ·
-
Feature request: Mask repository credentials in --verbose outputCó thể đã có người làm @Rajeshwari2857 đã nhận 5 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 58/100
aboutcode-org/python-inspector#254 · 4 bình luận · 4 reaction ·
-
Python Inspector version 0.15.0 contains the wrong version stringCó thể đã có người làm @Anurag-S1ngh đã nhận 4 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 45/100
aboutcode-org/python-inspector#253 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
aboutcode-org/python-inspector#246 · 2 bình luận · 2 reaction ·
Tất cả issue của aboutcode-org/python-inspector
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 4 ngày
-
Add alembic upgrade predeployĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
ClockGU/clockwork-backend#169 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
aws-samples/sample-per-model-bedrock#616 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
chnm/teachinghistory-hugo#47 ·
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
pandas-dev/pandas-stubs#2047 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày