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

micropipenv can't parse Poetry lock file format 2.0 #252

Closed
AntiCompositeNumber opened this issue Jan 2, 2023 · 6 comments
Closed

micropipenv can't parse Poetry lock file format 2.0 #252

AntiCompositeNumber opened this issue Jan 2, 2023 · 6 comments

Comments

@AntiCompositeNumber
Copy link

AntiCompositeNumber commented Jan 2, 2023

Describe the bug
micropipenv can't parse Poetry lock file format 2.0, which includes a files attribute.

To Reproduce
Steps to reproduce the behavior:

  1. Install current Poetry (1.3)
  2. Run poetry update or poetry lock to regenerate the lockfile
  3. Attempt to run micropipenv install
  4. Failed to parse poetry.lock and pyproject.toml: 'files'

Expected behavior
The files attribute should be parsed correctly or ignored.

Additional context
See python-poetry/poetry#6393

@frenzymadness
Copy link
Collaborator

Thanks for the report! I'll take a look. I'm not a user of poetry myself so it might take a while but from the linked PR it seems that only the structure has been changed but the content should be similar.

@frenzymadness
Copy link
Collaborator

Do I understand correctly that the files are no longer in the lock files? I've tried to lock one of the existing pyproject.toml files we have in the tests/data/install/poetry folder and the most important part of the diff is:

25c25
< content-hash = "46444b08fe9dc1a5b346aa11e455aaa41feffd77a377d86037fe55cffb0ec682"
---
> lock-version = "1.1"
26a27
> content-hash = "46444b08fe9dc1a5b346aa11e455aaa41feffd77a377d86037fe55cffb0ec682"
29,35c30,31
< daiquiri = [
<     {file = "daiquiri-2.0.0-py2.py3-none-any.whl", hash = "sha256:d57b9fd5432933c6e899054eb62cee22eab89f560c8493254d327ec27893c866"},
<     {file = "daiquiri-2.0.0.tar.gz", hash = "sha256:6b235ed15b73b87fd3cc2521aacbb727bf8443a0896dc534b07503841d03cfdb"},
< ]
< python-json-logger = [
<     {file = "python-json-logger-0.1.11.tar.gz", hash = "sha256:b7a31162f2a01965a5efb94453ce69230ed208468b0bbc7fdfc56e6d8df2e281"},
< ]
---
> daiquiri = []
> python-json-logger = []

This should be easy to fix but I'm not sure what will happen for the rest of the codebase if we'll have an empty list of files. Will try it and see.

@AntiCompositeNumber
Copy link
Author

The file data wasn't removed, it was just moved.

diff --git a/poetry.lock.old b/poetry.lock
index 1109733..8f1d7bf 100644
--- a/poetry.lock.old
+++ b/poetry.lock
@@ -1,3 +1,5 @@
+# This file is automatically @generated by Poetry and should not be changed by hand.
+
 [[package]]
 name = "urllib3"
 version = "1.26.13"
@@ -5,6 +7,10 @@ description = "HTTP library with thread-safe connection pooling, file post, and
 category = "main"
 optional = false
 python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*"
+files = [
+    {file = "urllib3-1.26.13-py2.py3-none-any.whl", hash = "sha256:47cc05d99aaa09c9e72ed5809b60e7ba354e64b59c9c173ac3018642d8bb41fc"},
+    {file = "urllib3-1.26.13.tar.gz", hash = "sha256:c083dd0dce68dbfbe1129d5271cb90f9447dea7d52097c6e0126120c521ddea8"},
+]
 
 [package.extras]
 brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)", "brotlipy (>=0.6.0)"]
@@ -12,12 +18,6 @@ secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "ipaddress", "p
 socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
 
 [metadata]
-lock-version = "1.1"
+lock-version = "2.0"
 python-versions = "^3.10"
 content-hash = "243d3fb67bbe1965e1d81eb651062f8136c8ee4a26bab9e630f38f19c278b3a3"
-
-[metadata.files]
-urllib3 = [
-    {file = "urllib3-1.26.13-py2.py3-none-any.whl", hash = "sha256:47cc05d99aaa09c9e72ed5809b60e7ba354e64b59c9c173ac3018642d8bb41fc"},
-    {file = "urllib3-1.26.13.tar.gz", hash = "sha256:c083dd0dce68dbfbe1129d5271cb90f9447dea7d52097c6e0126120c521ddea8"},
-]

Here is a gist with a sample old and new lock file.

@frenzymadness frenzymadness mentioned this issue Jan 4, 2023
2 tasks
@frenzymadness
Copy link
Collaborator

Thank you! You are right, I was using the wrong poetry version. I'm working on a fix so PR should be ready for review soon.

@frenzymadness
Copy link
Collaborator

PR #253 is now ready for review.

@frenzymadness
Copy link
Collaborator

Thanks for your help and the report. The problem is fixed and the fix is released.

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