pip-check-reqs icon indicating copy to clipboard operation
pip-check-reqs copied to clipboard

pip-missing-reqs fails when #egg is omitted from git+https package

Open sed-i opened this issue 3 years ago • 2 comments

When setup.py declares setup(name="...", ...), and the #egg suffix is omitted, then pip-missing-reqs fails:

Traceback (most recent call last):
  File "/.../pip-missing-reqs", line 8, in <module>
    sys.exit(main())
  File "/.../lib/python3.9/site-packages/pip_check_reqs/find_missing_reqs.py", line 171, in main
    missing = find_missing_reqs(
  File "/.../lib/python3.9/site-packages/pip_check_reqs/find_missing_reqs.py", line 99, in find_missing_reqs
    explicit.add(canonicalize_name(requirement_name))
  File "/.../lib/python3.9/site-packages/packaging/utils.py", line 34, in canonicalize_name
    value = _canonicalize_regex.sub("-", name).lower()
TypeError: expected string or bytes-like object

sed-i avatar Oct 08 '21 04:10 sed-i

This happens because parse_requirements in find_missing_reqs.py returns None when it encounters something that isn't a "named requirement" in the PEP-508 sense. E.g.:

mkdir test
touch test/__init__.py
pip-missing-reqs --requirements-file <(echo "-e file:foo") test

MrMino avatar Mar 19 '22 10:03 MrMino

Similar things happen with -e file:path/to/local/dir requirements.

Furthermore, it should be noted, that without the requirement being actually installed, it would be rather difficult to use URLs without explicit name fragment. We would have to request the relevant data from the remote VCS or even download the repo as a whole.

In cases where a name cannot be directly figured out without jumping through hoops such as network or VCS checkouts, we should either fail on these requirements when run without specifying some flag, or warn about them and refuse to perform the check.

MrMino avatar Mar 19 '22 11:03 MrMino