Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] setuptools fails on 'pytz (>dev)' with 'Expected closing RIGHT_PARENTHESIS' #3889

Closed
kiilerix opened this issue Apr 9, 2023 · 3 comments
Labels
bug Needs Triage Issues that need to be evaluated for severity and status.

Comments

@kiilerix
Copy link

kiilerix commented Apr 9, 2023

setuptools version

setuptools==67.0

Python version

Python 3.11 and others

OS

Fedora Linux

Additional environment information

No response

Description

Installing Kallithea as described on https://kallithea.readthedocs.io/en/default/contributing.html#getting-started works fine when only upgrading setuptools to < 67 .

With 67 or later, it fails as

$ gearbox serve -c my.ini --reload 
15:56:54,111 ERROR [gearbox] Expected closing RIGHT_PARENTHESIS
    pytz (>dev)
         ~^

The error seems to come from the vendered packaging, when stumbling upon venv/lib/python3.11/site-packages/celery-5.0.5.dist-info/METADATA with Requires-Dist: pytz (>dev). It might be an issue in celery, and it might already be fixed in later celery versions, but it is still a regression in setuptools.

Expected behavior

I expect it to work with setuptools 67 as it does with setuptools 66.

How to Reproduce

hg clone https://kallithea-scm.org/repos/kallithea
cd kallithea
python3 -m venv venv
. venv/bin/activate
pip install --upgrade pip setuptools
pip install --upgrade -e . -r dev_requirements.txt python-ldap python-pam
kallithea-cli config-create my.ini

Output

...
  File "/tmp/kallithea/venv/lib64/python3.11/site-packages/celery/bin/celery.py", line 11, in <module>
    from pkg_resources import iter_entry_points
  File "/tmp/kallithea/venv/lib64/python3.11/site-packages/pkg_resources/__init__.py", line 3323, in <module>
    @_call_aside
     ^^^^^^^^^^^
  File "/tmp/kallithea/venv/lib64/python3.11/site-packages/pkg_resources/__init__.py", line 3298, in _call_aside
    f(*args, **kwargs)
  File "/tmp/kallithea/venv/lib64/python3.11/site-packages/pkg_resources/__init__.py", line 3336, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/kallithea/venv/lib64/python3.11/site-packages/pkg_resources/__init__.py", line 629, in _build_master
    ws.require(__requires__)
  File "/tmp/kallithea/venv/lib64/python3.11/site-packages/pkg_resources/__init__.py", line 966, in require
    needed = self.resolve(parse_requirements(requirements))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/kallithea/venv/lib64/python3.11/site-packages/pkg_resources/__init__.py", line 832, in resolve
    new_requirements = dist.requires(req.extras)[::-1]
                       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/kallithea/venv/lib64/python3.11/site-packages/pkg_resources/__init__.py", line 2821, in requires
    dm = self._dep_map
         ^^^^^^^^^^^^^
  File "/tmp/kallithea/venv/lib64/python3.11/site-packages/pkg_resources/__init__.py", line 3107, in _dep_map
    self.__dep_map = self._compute_dependencies()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/kallithea/venv/lib64/python3.11/site-packages/pkg_resources/__init__.py", line 3117, in _compute_dependencies
    reqs.extend(parse_requirements(req))
  File "/tmp/kallithea/venv/lib64/python3.11/site-packages/pkg_resources/__init__.py", line 3170, in __init__
    super(Requirement, self).__init__(requirement_string)
  File "/tmp/kallithea/venv/lib64/python3.11/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 37, in __init__
    raise InvalidRequirement(str(e)) from e
pkg_resources.extern.packaging.requirements.InvalidRequirement: Expected closing RIGHT_PARENTHESIS
    pytz (>dev)
         ~^
@kiilerix kiilerix added bug Needs Triage Issues that need to be evaluated for severity and status. labels Apr 9, 2023
@abravalheri
Copy link
Contributor

Hi @kiilerix, pytz (>dev) is not a valid dependency specifier according to PEP 508/PEP 440. The error seems to come specifically from the version dev (which is not a valid version for a Python package). A valid version would look something like 0.dev1.

Previous versions of setuptools used to emit a deprecation warning about this.
After some years of announcing this deprecation, setuptools removed support for malformed dependency specifiers1.

I don't think there is an action point to be followed here.

Footnotes

  1. Setuptools relies on pypa/packaging for parsing dependencies and recent versions of pypa/packaging no longer support this kind of specifiers.

@kiilerix
Copy link
Author

It is however a regression for my use case. But ok, fair if enough if it is a deliberate or acceptable regression in a "garbage in" undefined behaviour. I can't update the celery dependency on my stable branch, so I guess I will have to add a constraint on setuptools<67.

@abravalheri
Copy link
Contributor

Thanks @kiilerix. I will close this issue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Needs Triage Issues that need to be evaluated for severity and status.
Projects
None yet
Development

No branches or pull requests

2 participants