Skip to content

Parsing error whenever specifying url and optional inside dependency #2824

@evilyach

Description

@evilyach
  • OS version and name: Ubuntu 20.04 (Linux 5.4.0-42-generic)
  • Poetry version: 1.0.10, 1.1.0b2, master branch
  • Link of a Gist with the contents of your pyproject.toml file:

Issue

Whenever you have url and optional inside the same dependency, it crashes when trying to install the built wheel. The gist is available above.

The listings of logs:

$ poetry build
Building test-repo (0.1.0)
 - Building sdist
 - Built test-repo-0.1.0.tar.gz

 - Building wheel
 - Built test_repo-0.1.0-py3-none-any.whl

$ pip3 install dist/test_repo-0.1.0-py3-none-any.whl
Processing ./dist/test_repo-0.1.0-py3-none-any.whl
ERROR: Exception:
Traceback (most recent call last):
  File "/home/evilyach/dev/test-repo/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 3021, in _dep_map
    return self.__dep_map
  File "/home/evilyach/dev/test-repo/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2815, in __getattr__
    raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/evilyach/dev/test-repo/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/_vendor/packaging/requirements.py", line 90, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "/home/evilyach/dev/test-repo/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/_vendor/pyparsing.py", line 1654, in parseString
    raise exc
  File "/home/evilyach/dev/test-repo/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/_vendor/pyparsing.py", line 1644, in parseString
    loc, tokens = self._parse( instring, 0 )
  File "/home/evilyach/dev/test-repo/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/evilyach/dev/test-repo/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/_vendor/pyparsing.py", line 3417, in parseImpl
    loc, exprtokens = e._parse( instring, loc, doActions )
  File "/home/evilyach/dev/test-repo/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/_vendor/pyparsing.py", line 1406, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/home/evilyach/dev/test-repo/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/_vendor/pyparsing.py", line 3205, in parseImpl
    raise ParseException(instring, loc, self.errmsg, self)
pkg_resources._vendor.pyparsing.ParseException: Expected stringEnd (at char 149), (line:1, col:150)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/evilyach/dev/test-repo/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 3101, in __init__
    super(Requirement, self).__init__(requirement_string)
  File "/home/evilyach/dev/test-repo/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/_vendor/packaging/requirements.py", line 92, in __init__
    raise InvalidRequirement(
pkg_resources.extern.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'extra =='"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/evilyach/dev/test-repo/venv/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 186, in _main
    status = self.run(options, args)
  File "/home/evilyach/dev/test-repo/venv/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 357, in run
    resolver.resolve(requirement_set)
  File "/home/evilyach/dev/test-repo/venv/lib/python3.8/site-packages/pip/_internal/legacy_resolve.py", line 177, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  File "/home/evilyach/dev/test-repo/venv/lib/python3.8/site-packages/pip/_internal/legacy_resolve.py", line 382, in _resolve_one
    set(req_to_install.extras) - set(dist.extras)
  File "/home/evilyach/dev/test-repo/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 2978, in extras
    return [dep for dep in self._dep_map if dep]
  File "/home/evilyach/dev/test-repo/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 3023, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "/home/evilyach/dev/test-repo/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 3033, in _compute_dependencies
    reqs.extend(parse_requirements(req))
  File "/home/evilyach/dev/test-repo/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 3094, in parse_requirements
    yield Requirement(line)
  File "/home/evilyach/dev/test-repo/venv/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl/pkg_resources/__init__.py", line 3103, in __init__
    raise RequirementParseError(str(e))
pkg_resources.RequirementParseError: Invalid requirement, parse error at "'extra =='"

Contents of PKG-INFO:

 cat PKG-INFO
Metadata-Version: 2.1
Name: test-repo
Version: 0.1.0
Summary:
Author: Ilya Chesalin
Author-email: [email protected]
Requires-Python: >=3.8,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Provides-Extra: json
Requires-Dist: json5 @ https://files.pythonhosted.org/packages/2b/81/22bf51a5bc60dde18bb6164fd597f18ee683de8670e141364d9c432dd3cf/json5-0.9.5-py2.py3-none-any.whl; extra == "json"

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expectedstatus/waiting-on-coreRequires changes to poetry-core first

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions