kazhala / InquirerPy

:snake: Python port of Inquirer.js (A collection of common interactive command-line user interfaces)
https://inquirerpy.readthedocs.io
MIT License
357 stars 19 forks source link

pipx install errors on some systems for packages depending on InquirerPy #61

Open kjteske opened 1 year ago

kjteske commented 1 year ago

We've got a python package that depends on InquirerPy, and we want to install this package using pipx.

However, on Ubuntu 22.04, this errors:

> pipx install --index-url <our internal PyPi URL> <our internal python package depending on InquirerPy>

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/packaging/requirements.py", line 35, in __init__
    parsed = parse_requirement(requirement_string)
  File "/usr/local/lib/python3.10/dist-packages/packaging/_parser.py", line 64, in parse_requirement
    return _parse_requirement(Tokenizer(source, rules=DEFAULT_RULES))
  File "/usr/local/lib/python3.10/dist-packages/packaging/_parser.py", line 82, in _parse_requirement
    url, specifier, marker = _parse_requirement_details(tokenizer)
  File "/usr/local/lib/python3.10/dist-packages/packaging/_parser.py", line 116, in _parse_requirement_details
    specifier = _parse_specifier(tokenizer)
  File "/usr/local/lib/python3.10/dist-packages/packaging/_parser.py", line 203, in _parse_specifier
    with tokenizer.enclosing_tokens("LEFT_PARENTHESIS", "RIGHT_PARENTHESIS"):
  File "/usr/lib/python3.10/contextlib.py", line 142, in __exit__
    next(self.gen)
  File "/usr/local/lib/python3.10/dist-packages/packaging/_tokenizer.py", line 181, in enclosing_tokens
    self.raise_syntax_error(
  File "/usr/local/lib/python3.10/dist-packages/packaging/_tokenizer.py", line 161, in raise_syntax_error
    raise ParserSyntaxError(
packaging._tokenizer.ParserSyntaxError: Expected closing RIGHT_PARENTHESIS
    furo (>=2021.8.17-beta.43,<2022.0.0); extra == "docs"

The issue is that furo's version, 2021.8.17-beta.43, is not PEP 440 compliant; we get this dep from InquirerPy.

furo has fixed their versioning: 2021.8.17b43 is available now and is PEP 440-compliant.

I believe the only change needed to InquirerPy is to change the version of furo in pyproject.toml from "^2021.8.17-beta.43" to "^2021.8.17b43".

For now, our workaround is to explicity install an older version of packaging that allows the 2021.8.17-beta.43 version format, i.e.:

pip install packaging==21.3
pipx install --index-url <our internal PyPi URL> <our internal python package depending on InquirerPy>

In the future though, this workaround will break when pipx eventually requires a newer version of packaging.