Closed pawamoy closed 3 months ago
As to why the test suite failed with pip 18.0:
% pytest tests
ImportError while loading conftest '/media/data/dev/pipdeptree/tests/conftest.py'.
tests/conftest.py:9: in <module>
from pipdeptree._models import PackageDAG
src/pipdeptree/_models/__init__.py:3: in <module>
from .dag import PackageDAG, ReversedPackageDAG
src/pipdeptree/_models/dag.py:12: in <module>
from .package import DistPackage, ReqPackage, pep503_normalize
src/pipdeptree/_models/package.py:10: in <module>
from pip._vendor.pkg_resources import Requirement # noqa: PLC2701
.venv/lib/python3.11/site-packages/pip/_vendor/pkg_resources/__init__.py:77: in <module>
__import__('pip._vendor.packaging.requirements')
.venv/lib/python3.11/site-packages/pip/_vendor/packaging/requirements.py:9: in <module>
from pip._vendor.pyparsing import stringStart, stringEnd, originalTextFor, ParseException
.venv/lib/python3.11/site-packages/pip/_vendor/pyparsing.py:943: in <module>
collections.MutableMapping.register(ParseResults)
E AttributeError: module 'collections' has no attribute 'MutableMapping'
I'll run the same script on other supported Python versions to make sure 18.1 is the lowest.
Failed with pip 23.1.1 on Python 3.12:
% pytest tests
ImportError while loading conftest '/media/data/dev/pipdeptree/tests/conftest.py'.
tests/conftest.py:9: in <module>
from pipdeptree._models import PackageDAG
src/pipdeptree/_models/__init__.py:3: in <module>
from .dag import PackageDAG, ReversedPackageDAG
src/pipdeptree/_models/dag.py:12: in <module>
from .package import DistPackage, ReqPackage, pep503_normalize
src/pipdeptree/_models/package.py:10: in <module>
from pip._vendor.pkg_resources import Requirement # noqa: PLC2701
.venv/lib/python3.12/site-packages/pip/_vendor/pkg_resources/__init__.py:2191: in <module>
register_finder(pkgutil.ImpImporter, find_on_path)
E AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
Yeah I notice pip>=23.3.1
is used in the optional test dependencies :thinking:
OK, tested on all supported Python versions:
Dependencies updated accordingly.
We ran the test suite with a decreasing version of pip until it failed at 18.0.
The above text is the commit message. Feel free to reword it by squashing the PR.
Output of the script:
It's possible that lower versions would work, and only 18.0 failed because of some bug in it. However I feel like v18.1 is old enough and we don't have to support even lower versions. Happy to test further down if you disagree!
IMPORTANT: I consider this PR a quick fix for #335, waiting for a better solution such as #333. Feel free to close this PR if you don't plan on merging it and quickly releasing a new version with pip as a dependency before merging and releasing #333.
Closes #335.