Exception in requirements.txt

Open
#128 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
devtools

Research direction

Reproduce the failure with the shown python-inspector command and requirements.txt, then inspect python_inspector/setup_py_live_eval.py and resolution.py at the traceback locations. Done means the netifaces requirement resolves without the AttributeError and the command produces pp.json; no repository test is named in the issue.

Written by the indexing model from the issue text.

Description

requirements.txt:

netifaces==0.10.4

running:

python-inspector -r requirements.txt -p 310 -o linux --json ./pp.json --analyze-setup-py-insecurely

traceback:

Traceback (most recent call last):
  File "/home/daniel/.local/lib/python3.10/site-packages/python_inspector/resolve_cli.py", line 247, in resolve_dependencies
    resolution_result: Dict = resolver_api(
  File "/home/daniel/.local/lib/python3.10/site-packages/python_inspector/api.py", line 254, in resolve_dependencies
    resolution, purls = resolve(
  File "/home/daniel/.local/lib/python3.10/site-packages/python_inspector/api.py", line 313, in resolve
    resolved_dependencies, packages = get_resolved_dependencies(
  File "/home/daniel/.local/lib/python3.10/site-packages/python_inspector/api.py", line 351, in get_resolved_dependencies
    resolver_results = resolver.resolve(requirements=requirements, max_rounds=max_rounds)
  File "/home/daniel/.local/lib/python3.10/site-packages/resolvelib/resolvers.py", line 546, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/home/daniel/.local/lib/python3.10/site-packages/resolvelib/resolvers.py", line 427, in resolve
    failure_causes = self._attempt_to_pin_criterion(name)
  File "/home/daniel/.local/lib/python3.10/site-packages/resolvelib/resolvers.py", line 239, in _attempt_to_pin_criterion
    criteria = self._get_updated_criteria(candidate)
  File "/home/daniel/.local/lib/python3.10/site-packages/resolvelib/resolvers.py", line 229, in _get_updated_criteria
    for requirement in self._p.get_dependencies(candidate=candidate):
  File "/home/daniel/.local/lib/python3.10/site-packages/python_inspector/resolution.py", line 639, in get_dependencies
    return list(self._iter_dependencies(candidate))
  File "/home/daniel/.local/lib/python3.10/site-packages/python_inspector/resolution.py", line 630, in _iter_dependencies
    for r in self.get_requirements_for_package(purl=purl, candidate=candidate):
  File "/home/daniel/.local/lib/python3.10/site-packages/python_inspector/resolution.py", line 509, in get_requirements_for_package_from_pypi_simple
    yield from get_requirements_from_python_manifest(
  File "/home/daniel/.local/lib/python3.10/site-packages/python_inspector/resolution.py", line 299, in get_requirements_from_python_manifest
    yield from get_reqs_insecurely(
  File "/home/daniel/.local/lib/python3.10/site-packages/python_inspector/resolution.py", line 277, in get_reqs_insecurely
    yield from parse_reqs_from_setup_py_insecurely(setup_py=setup_py_location)
  File "/home/daniel/.local/lib/python3.10/site-packages/python_inspector/resolution.py", line 128, in parse_reqs_from_setup_py_insecurely
    for req in iter_requirements(level="", extras=[], setup_file=setup_py):
  File "/home/daniel/.local/lib/python3.10/site-packages/python_inspector/setup_py_live_eval.py", line 117, in iter_requirements
    exec(file_contents, g)
  File "<string>", line 17, in <module>
AttributeError: 'dict' object has no attribute 'print'

CC @sschuberth since this showed up in ORT.
CC @qequ @arieltorti

python-inspector version 0.9.5

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from aboutcode-org/python-inspector

All issues in aboutcode-org/python-inspector

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.