Poetry: Poetry fails to install mypyls

Created on 19 Apr 2020  路  1Comment  路  Source: python-poetry/poetry

  • [x] I am on the latest Poetry version.
  • [x] I have searched the issues of this repo and believe that this is not a duplicate.
  • [x] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Fedora 31
  • Poetry version: 1.0.5

Issue


I can't seem to add a mypyls dependency in any way to pyproject.toml. The project lives here: https://github.com/matangover/mypyls and it's usually installed via:

pip install "https://github.com/matangover/mypyls/archive/master.zip#egg=mypyls[default-mypy]"

The following things don't work:

  1. poetry add https://github.com/matangover/mypyls/archive/master.zip due to
Traceback (most recent call last):
  File "/home/viraptor/.local/lib/python3.7/site-packages/clikit/console_application.py", line 131, in run
    status_code = command.handle(parsed_args, io)
  File "/home/viraptor/.local/lib/python3.7/site-packages/clikit/api/command/command.py", line 120, in handle
    status_code = self._do_handle(args, io)
  File "/home/viraptor/.local/lib/python3.7/site-packages/clikit/api/command/command.py", line 171, in _do_handle
    return getattr(handler, handler_method)(args, io, self)
  File "/home/viraptor/.local/lib/python3.7/site-packages/cleo/commands/command.py", line 92, in wrap_handle
    return self.handle()
  File "/home/viraptor/.local/lib/python3.7/site-packages/poetry/console/commands/add.py", line 89, in handle
    packages, allow_prereleases=self.option('allow-prereleases')
  File "/home/viraptor/.local/lib/python3.7/site-packages/poetry/console/commands/init.py", line 293, in _determine_requirements
    requires = self._parse_requirements(requires)
  File "/home/viraptor/.local/lib/python3.7/site-packages/poetry/console/commands/init.py", line 388, in _parse_requirements
    package = Provider.get_package_from_url(requirement)
  File "/home/viraptor/.local/lib/python3.7/site-packages/poetry/puzzle/provider.py", line 466, in get_package_from_url
    package = cls.get_package_from_file(temp_dir / file_name)
  File "/home/viraptor/.local/lib/python3.7/site-packages/poetry/puzzle/provider.py", line 249, in get_package_from_file
    package = Package(info['name'], info['version'])
  File "/home/viraptor/.local/lib/python3.7/site-packages/poetry/packages/package.py", line 46, in __init__
    self._version = Version.parse(version)
  File "/home/viraptor/.local/lib/python3.7/site-packages/poetry/semver/version.py", line 206, in parse
    raise ParseVersionError('Unable to parse "{}".'.format(text))
  1. Adding either of the following to pyproject.toml:
mypyls = {url = "https://github.com/matangover/mypyls/archive/master.zip", extras = ["default-mypy"]}
mypyls = {git = "https://github.com/matangover/mypyls.git", extras = ["default-mypy"]}

due to poetry update mypyls showing:

[SolverProblemError]
Because foobar depends on mypyls (*) which doesn't exist, version solving failed.
Bug Triage

Most helpful comment

For the url dependnecy, the root cause here is because we end up falling back to AST parser for setup.py since the sdist does not containe distrition information. The since the version is populated dynamically, we end up not being able to retirve this information.

https://github.com/matangover/mypyls/blob/616d66257eda8f4b7fc5115260e15f41358852b6/setup.py#L12

As for the git dependency, the issue is the parsing of the direct referene dependencies. At the moment, poetry do not understand understand these. But this should be resolved with (python-poetry/core#22).

https://github.com/matangover/mypyls/blob/616d66257eda8f4b7fc5115260e15f41358852b6/setup.py#L31

As for what we could do to improve this situation;

  • consider improving url parsing to include additional metadata.
  • use pep517 builds to allow meatdata discovery if feasible.
  • improve support for PEP-440 direct reference dependencies (python-poetry/core#22)

>All comments

For the url dependnecy, the root cause here is because we end up falling back to AST parser for setup.py since the sdist does not containe distrition information. The since the version is populated dynamically, we end up not being able to retirve this information.

https://github.com/matangover/mypyls/blob/616d66257eda8f4b7fc5115260e15f41358852b6/setup.py#L12

As for the git dependency, the issue is the parsing of the direct referene dependencies. At the moment, poetry do not understand understand these. But this should be resolved with (python-poetry/core#22).

https://github.com/matangover/mypyls/blob/616d66257eda8f4b7fc5115260e15f41358852b6/setup.py#L31

As for what we could do to improve this situation;

  • consider improving url parsing to include additional metadata.
  • use pep517 builds to allow meatdata discovery if feasible.
  • improve support for PEP-440 direct reference dependencies (python-poetry/core#22)
Was this page helpful?
0 / 5 - 0 ratings