Python inspector command fails when requirements.txt includes sys_platform
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 52/100
Research direction
Reproduce the failure with the shown python-inspector command and requirements.txt, then inspect python_inspector/resolution.py around find_matches and _iter_matches, following the call from python_inspector/api.py. Done means the command completes for the sys_platform requirement and resolves torch==2.8.0 for the shown macOS case without raising NoVersionsFound.
Written by the indexing model from the issue text.
Description
Python inspector command fails to scan when some packages include system platform information:
>python-inspector --requirement requirements.txt -p 313 -o macos --json-pdt tmp.json
Traceback (most recent call last):
File "~/Documents/misc/python-torch-multi-platform/.venv/lib/python3.13/site-packages/python_inspector/resolve_cli.py", line 259, in resolve_dependencies
resolution_result: Dict = resolver_api(
~~~~~~~~~~~~^
requirement_files=requirement_files,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<15 lines>...
generic_paths=generic_paths,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "~/Documents/misc/python-torch-multi-platform/.venv/lib/python3.13/site-packages/python_inspector/api.py", line 283, in resolve_dependencies
resolution, purls = resolve(
~~~~~~~^
direct_dependencies=direct_dependencies,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<8 lines>...
printer=printer,
^^^^^^^^^^^^^^^^
)
^
File "~/Documents/misc/python-torch-multi-platform/.venv/lib/python3.13/site-packages/python_inspector/api.py", line 374, in resolve
resolved_dependencies, packages = get_resolved_dependencies(
~~~~~~~~~~~~~~~~~~~~~~~~~^
requirements=requirements,
^^^^^^^^^^^^^^^^^^^^^^^^^^
...<8 lines>...
printer=printer,
^^^^^^^^^^^^^^^^
)
^
File "~/Documents/misc/python-torch-multi-platform/.venv/lib/python3.13/site-packages/python_inspector/api.py", line 465, in get_resolved_dependencies
resolver_results = resolver.resolve(requirements=requirements, max_rounds=max_rounds)
File "~/Documents/misc/python-torch-multi-platform/.venv/lib/python3.13/site-packages/resolvelib/resolvers/resolution.py", line 596, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "~/Documents/misc/python-torch-multi-platform/.venv/lib/python3.13/site-packages/resolvelib/resolvers/resolution.py", line 429, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "~/Documents/misc/python-torch-multi-platform/.venv/lib/python3.13/site-packages/resolvelib/resolvers/resolution.py", line 125, in _add_to_criteria
matches = self._p.find_matches(
identifier=identifier,
...<9 lines>...
),
)
File "~/Documents/misc/python-torch-multi-platform/.venv/lib/python3.13/site-packages/python_inspector/resolution.py", line 634, in find_matches
candidates = sorted(
self._iter_matches(identifier, requirements, incompatibilities),
key=operator.attrgetter("version"),
reverse=True,
)
File "~/Documents/misc/python-torch-multi-platform/.venv/lib/python3.13/site-packages/python_inspector/resolution.py", line 617, in _iter_matches
raise NoVersionsFound(f"This package does not exist: {name}")
python_inspector.error.NoVersionsFound: This package does not exist: torch
The requirements.txt file (https://github.com/voidpetal/pyinsp-system-platform-test/tree/main):
torch==2.8.0; sys_platform != "linux"
- Dominant language
- Python
- Stars
- 23
- Forks
- 29
- Avg merge
- 1h 7m
- Merged PRs (30d)
- 2
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aboutcode-org/python-inspector
-
`packages` is empty when using a non-pypi.org simple index (e.g. Sonatype Nexus)Possibly taken @avika269 claimed this 6 days ago. Open
Difficulty 3/5 Half a day Newbie friendliness 62/100
aboutcode-org/python-inspector#268 · 2 comments ·
-
InconsistentCandidate: Pre-Release not allowMay be free again @Anurag-S1ngh claimed this 25 days ago, and no pull request is open. Openbug design nice-to-have
Difficulty 4/5 3-5 days Newbie friendliness 35/100
aboutcode-org/python-inspector#257 · 1 comment ·
-
Python Inspector version 0.15.0 contains the wrong version stringMay be free again @Anurag-S1ngh claimed this 18 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
aboutcode-org/python-inspector#253 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
aboutcode-org/python-inspector#242 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
aboutcode-org/python-inspector#241 · 3 comments ·
All issues in aboutcode-org/python-inspector
Similar issues
-
opensubtitlescom: provider rejects pt-PT even though its own converter maps itPossibly taken @paulo-0308 claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Diaoul/subliminal#1405 ·
-
Internal ErrorOpenbug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
frappe/frappe_docker#2071 ·
Maintainers usually reply within 1 day
-
bug python
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
traceloop/openllmetry#4717 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
The-Pocket/PocketFlow#161 ·
-
comp/desktop P2 type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NousResearch/hermes-agent#157702 ·
Maintainers usually reply within 1 day