Skip to content
This repository has been archived by the owner on Jan 12, 2021. It is now read-only.

dephell doesn't properly parse valid poetry dependencies (eg. tox = "^tox 3.11") #460

Open
FFY00 opened this issue Aug 27, 2020 · 3 comments

Comments

@FFY00
Copy link

FFY00 commented Aug 27, 2020

Short description

dephell fails to parse some valid poetry dependencies. portey works just fine but dephell errors out.

Output

WARNING cannot find tool.dephell section in the config (path=pyproject.toml)
ERROR InvalidSpecifier: ^tox

Steps to reproduce

$ dephell deps convert --from pyproject.toml --to setup.py

Traceback

WARNING cannot find tool.dephell section in the config (path=pyproject.toml)
ERROR InvalidSpecifier: ^tox
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/dephell/cli.py", line 66, in main
    result = handler()
  File "/usr/lib/python3.8/site-packages/dephell/commands/deps_convert.py", line 45, in __call__
    resolver = loader.load_resolver(path=self.config['from']['path'])
  File "/usr/lib/python3.8/site-packages/dephell/converters/base.py", line 94, in load_resolver
    root = self.load(path=path)
  File "/usr/lib/python3.8/site-packages/dephell/converters/base.py", line 54, in load
    root = self.loads(content=stream.read())
  File "/usr/lib/python3.8/site-packages/dephell/converters/poetry.py", line 112, in loads
    deps.extend(self._make_deps(
  File "/usr/lib/python3.8/site-packages/dephell/converters/poetry.py", line 331, in _make_deps
    constraint=Constraint(root, content),
  File "/usr/lib/python3.8/site-packages/dephell/models/constraint.py", line 14, in __init__
    self._specs = {source.name: RangeSpecifier(spec)}
  File "/usr/lib/python3.8/site-packages/dephell_specifier/range_specifier.py", line 40, in __init__
    self._specs = self._parse(spec)
  File "/usr/lib/python3.8/site-packages/dephell_specifier/range_specifier.py", line 66, in _parse
    result.update(cls._parse_npm(constr))
  File "/usr/lib/python3.8/site-packages/dephell_specifier/range_specifier.py", line 146, in _parse_npm
    raise InvalidSpecifier(constr)
packaging.specifiers.InvalidSpecifier: ^tox

Config

[tool.poetry.dev-dependencies]
tox = "^tox 3.11"

Example: https://github.com/SolidCode/SolidPython/blob/master/pyproject.toml

Versions

{
  "cache": "0b",
  "path": "/usr/lib/python3.8/site-packages/dephell",
  "python": "/usr/bin/python",
  "version": "0.8.3",
  "versions": {
    "dephell-archive": "0.1.5",
    "dephell-argparse": "0.1.3",
    "dephell-changelogs": "0.0.1",
    "dephell-discover": "0.2.10",
    "dephell-licenses": "0.1.7",
    "dephell-links": "0.1.4",
    "dephell-markers": "1.0.1",
    "dephell-pythons": "0.1.14",
    "dephell-setuptools": "0.2.1",
    "dephell-shells": "0.1.3",
    "dephell-specifier": "0.2.2",
    "dephell-venvs": "0.1.16",
    "dephell-versioning": "0.1.2"
  }
}
@eli-schwartz
Copy link
Contributor

what exactly does tox = "^tox 3.11" even mean? I don't see it described in the poetry documentation...

@FFY00
Copy link
Author

FFY00 commented Aug 30, 2020

Yet poetry accepts it... As you might imagine, it's the same as tox = "^3.11".

@eli-schwartz
Copy link
Contributor

And how can SolidPython rely on an undocumented parsing edge case in poetry? Poetry could tighten up its data validation routines at any time, resulting in their pyproject.toml failing to parse.

This really sounds like a dangerous bug in the pyproject.toml. What's poetry's perspective on accepting such files?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants