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

Parsing of poetry.lock generated with Poetry >= 1.5.0 fails #67

Open
plaa opened this issue Aug 3, 2023 · 1 comment
Open

Parsing of poetry.lock generated with Poetry >= 1.5.0 fails #67

plaa opened this issue Aug 3, 2023 · 1 comment

Comments

@plaa
Copy link

plaa commented Aug 3, 2023

  • Dependency Parser version: 0.6.3
  • Python version: 3.10.12
  • Operating System: MacOS Ventura

Description

Poetry has deprecated and in 1.5.0 removed writing of the category field into the poetry.lock file. dparse assumes this field to always be present. Thus dparse cannot parse poetry.lock files generated with a recent Poetry version and fails with the exception Malformed poetry lock file

dparse/dparse/parser.py

Lines 461 to 467 in eb917b3

try:
name = dep['name']
spec = "=={version}".format(
version=Version(dep['version']))
section = dep['category']
except KeyError:
raise KeyError("Malformed poetry lock file")

@snorfalorpagus
Copy link

What's the best choice here? Provide a default (section = dep.get('category'))? Or always ignore it (section = None)?

It looks like it was removed because it is unused "Do not write the unused package category into the lock file", I guess because of the introduction of groups in the pyproject.toml, which aren't referenced in the poetry.lock.

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

No branches or pull requests

2 participants