Skip to content

Support for Poetry lock format 2.0#23

Open
carlo-aromando wants to merge 1 commit into
soniaai:masterfrom
carlo-aromando:master
Open

Support for Poetry lock format 2.0#23
carlo-aromando wants to merge 1 commit into
soniaai:masterfrom
carlo-aromando:master

Conversation

@carlo-aromando
Copy link
Copy Markdown

This PR adds support for new lock format 2.0.

Fixes issue #22

@carlo-aromando carlo-aromando changed the title Support for Poetry 1.3 lock format Support for Poetry lock format 2.0 Jan 26, 2023
@bbstilson
Copy link
Copy Markdown

Any chance we could get this merged? It's blocking adoption 🙂

@Vertexwahn
Copy link
Copy Markdown

@NathanHowell Can you please merge this PR - I also need it!

@davidjlongo
Copy link
Copy Markdown

I'd love to see this merged!

@Vertexwahn
Copy link
Copy Markdown

I am not sure if the company Sonia still exists, and therefore we see no support here anymore. Should we clone the repo and move it to https://github.com/bazel-contrib and continue development there?

@ibolit
Copy link
Copy Markdown

ibolit commented Apr 11, 2023

@Vertexwahn Please, do. Our adoption of Bazel is blocked by this request as well

Comment thread rules_poetry/poetry.bzl
lockfile = json.decode(result.stdout)
metadata = lockfile["metadata"]
if "files" in metadata: # Poetry 1.x format
package_files = [{"name": package["name"], "files": package["files"]} for package in lockfile["package"] if package.get("files")]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would go for explicit version checking:

if metadata["lock-version"] in ["2.0"]:

etc. as far back as they had the lock-version item in metadata

@AndrewGuenther
Copy link
Copy Markdown
Collaborator

If anyone is interested, I dropped this package and made my own Bazel Poetry module which takes advantage of some of the more recent rules_python advancements to significantly simplify the implementation:

https://github.com/AndrewGuenther/rules_python_poetry

@ibolit
@Vertexwahn
@davidjlongo
@bbstilson

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

Successfully merging this pull request may close these issues.

6 participants