Conflicts with python versions on patch level

Open
#103 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
32/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
cli, tooling

Research direction

Reproduce with a requirements.txt containing anyio==3.6.1 and dataclasses==0.8, then run python-inspector -r requirements.txt --json-pdt - -o linux -p 36. Start from python_inspector/resolve_cli.py and python_inspector/api.py, which appear in the stack trace. Done means the CLI can handle the needed Python patch-level constraint or otherwise documents/handles this case without the shown ResolutionImpossible.

Written by the indexing model from the issue text.

Description

bug must have

We have a requirements.txt file that cannot be analyzed by Python Inspector due to conflicting dependencies. It boils down to the following two dependencies:

anyio==3.6.1
dataclasses==0.8

When running the command python-inspector -r requirements.txt --json-pdt - -o linux -p 36 it reports

raise ResolutionImpossible(e.criterion.information)
resolvelib.resolvers.ResolutionImpossible: [RequirementInformation(requirement=<Requirement('anyio==3.6.1')>, parent=None)]

When choosing a different Python version, e.g. 37 the problem is caused by the dataclasses library (see full stack trace below).

From what I found out, there seem to be only specific Python versions for which this constellation can work: dataclasses requires Python >=3.6, <3.7; anyio requires Python >=3.6.2. It is, however, not possible to define the Python version for Python Inspector on that level of detail. I assume that the 36 option will select a 3.6.0 version? So, should the corresponding option be extended to support an exact version number? Or is there another way how to solve this issue?

Here is the full stack trace:

Traceback (most recent call last):
  File "/home/heo1wa3/.local/lib/python3.8/site-packages/resolvelib/resolvers.py", line 372, in resolve
    self._add_to_criteria(self.state.criteria, r, parent=None)
  File "/home/heo1wa3/.local/lib/python3.8/site-packages/resolvelib/resolvers.py", line 173, in _add_to_criteria
    raise RequirementsConflicted(criterion)
resolvelib.resolvers.RequirementsConflicted: Requirements conflict: <Requirement('dataclasses==0.8')>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/heo1wa3/.local/lib/python3.8/site-packages/python_inspector/resolve_cli.py", line 246, in resolve_dependencies
    resolution_result: Dict = resolver_api(
  File "/home/heo1wa3/.local/lib/python3.8/site-packages/python_inspector/api.py", line 257, in resolve_dependencies
    resolution, purls = resolve(
  File "/home/heo1wa3/.local/lib/python3.8/site-packages/python_inspector/api.py", line 316, in resolve
    resolved_dependencies, packages = get_resolved_dependencies(
  File "/home/heo1wa3/.local/lib/python3.8/site-packages/python_inspector/api.py", line 354, in get_resolved_dependencies
    resolver_results = resolver.resolve(requirements=requirements, max_rounds=max_rounds)
  File "/home/heo1wa3/.local/lib/python3.8/site-packages/resolvelib/resolvers.py", line 521, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/home/heo1wa3/.local/lib/python3.8/site-packages/resolvelib/resolvers.py", line 374, in resolve
    raise ResolutionImpossible(e.criterion.information)
resolvelib.resolvers.ResolutionImpossible: [RequirementInformation(requirement=<Requirement('dataclasses==0.8')>, parent=None)]
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.