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

Multiple version peotry.lock causing TypeError: unhashable type: 'Container' #479

Open
ahmet2mir opened this issue Dec 17, 2020 · 1 comment

Comments

@ahmet2mir
Copy link

Short description

Hello,

When I try to convert a poetry.lock I got TypeError: unhashable type: 'Container' when peotry.lock has multiple versions

Adding a simple print(subname, subcontent, ) print before the exception show

aioredis [{'version': '>=0.3.3', 'optional': True, 'markers': 'python_version < "3.7" or python_version < "3.7" and extra == "redis"'}, {'version': '>=1.0.0', 'optional': True, 'markers': 'python_version >= "3.7" or python_version >= "3.7" and extra == "redis"'}]

Python can't convert a subcontent item of container type
to a set.

Maybe check the type before applying set and enforce using for exampe items() to convert it ?

Output

$ dephell deps convert --from-format poetrylock --from-path poetry.lock --to requirements.lock --envs main
ERROR TypeError: unhashable type: 'Container' 

Steps to reproduce

Add in peotry.lock

[package.dependencies]
aiomcache = {version = ">=0.5.2", optional = true, markers = "extra == \"memcached\""}
aioredis = [
    {version = ">=0.3.3", optional = true, markers = "python_version < \"3.7\" or python_version < \"3.7\" and extra == \"redis\""},
    {version = ">=1.0.0", optional = true, markers = "python_version >= \"3.7\" or python_version >= \"3.7\" and extra == \"redis\""},
]

Traceback

Traceback (most recent call last):
  File "/home/user/.cache/pypoetry/virtualenvs/hoqfXXHy-py3.8/lib/python3.8/site-packages/dephell/cli.py", line 66, in main
    result = handler()
  File "/home/user/.cache/pypoetry/virtualenvs/hoqfXXHy-py3.8/lib/python3.8/site-packages/dephell/commands/deps_convert.py", line 45, in __call__
    resolver = loader.load_resolver(path=self.config['from']['path'])
  File "/home/user/.cache/pypoetry/virtualenvs/hoqfXXHy-py3.8/lib/python3.8/site-packages/dephell/converters/base.py", line 94, in load_resolver
    root = self.load(path=path)
  File "/home/user/.cache/pypoetry/virtualenvs/hoqfXXHy-py3.8/lib/python3.8/site-packages/dephell/converters/base.py", line 54, in load
    root = self.loads(content=stream.read())
  File "/home/user/.cache/pypoetry/virtualenvs/hoqfXXHy-py3.8/lib/python3.8/site-packages/dephell/converters/poetrylock.py", line 62, in loads
    deps.extend(self._make_deps(
  File "/home/user/.cache/pypoetry/virtualenvs/hoqfXXHy-py3.8/lib/python3.8/site-packages/dephell/converters/poetrylock.py", line 167, in _make_deps
    subcontent = ','.join(set(subcontent))
TypeError: unhashable type: 'Container'

Config

[tool.poetry.dependencies]
python = ">=3.6,<=3.9"
aioredis = "^1.3.1"

Versions

{
  "cache": "22.47Mb",
  "path": "/home/user/.cache/pypoetry/virtualenvs/hoqfXXHy-py3.6/lib/python3.6/site-packages/dephell",
  "python": "/home/user/.cache/pypoetry/virtualenvs/hoqfXXHy-py3.6/bin/python",
  "version": "0.8.3",
  "versions": {
    "dephell-archive": "0.1.7",
    "dephell-argparse": "0.1.3",
    "dephell-changelogs": "0.0.1",
    "dephell-discover": "0.2.10",
    "dephell-licenses": "0.1.7",
    "dephell-links": "0.1.5",
    "dephell-markers": "1.0.3",
    "dephell-pythons": "0.1.15",
    "dephell-setuptools": "0.2.4",
    "dephell-shells": "0.1.5",
    "dephell-specifier": "0.2.2",
    "dephell-venvs": "0.1.18",
    "dephell-versioning": "0.1.2"
  }
}
@ahmet2mir
Copy link
Author

similar to #256

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

1 participant