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

Poetry fails to install mypyls #2321

Closed
3 tasks done
viraptor opened this issue Apr 19, 2020 · 3 comments
Closed
3 tasks done

Poetry fails to install mypyls #2321

viraptor opened this issue Apr 19, 2020 · 3 comments
Labels
kind/bug Something isn't working as expected

Comments

@viraptor
Copy link

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • 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.
@viraptor viraptor added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Apr 19, 2020
@abn
Copy link
Member

abn commented Apr 19, 2020

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/poetry-core#22).

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

As for what we could do to improve this situation;

@finswimmer
Copy link
Member

finswimmer commented Aug 2, 2021

Since version 1.1 poetry falls back to build the package accordoing to PEP518 if it cannot parse the needed information, this is no longer an issue.

@abn abn removed the status/triage This issue needs to be triaged label Mar 3, 2022
Copy link

github-actions bot commented Mar 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

3 participants