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

Parse metadata fields from sdist artifacts #7

Merged
merged 5 commits into from
Nov 14, 2024
Merged

Conversation

amjith
Copy link
Contributor

@amjith amjith commented Nov 14, 2024

No description provided.

@amjith amjith requested a review from thatch November 14, 2024 04:22
@@ -90,11 +93,29 @@ def test_basic_metadata_absl_py_09(self) -> None:
)
self.assertEqual({"test"}, bm.provides_extra)

def test_basic_metadata_fields(self) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

can you include a couple more words about who does this -- is this from modern setuptools, or something else like flit/poetry/hatchling

Copy link
Contributor Author

@amjith amjith Nov 14, 2024

Choose a reason for hiding this comment

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

Update test to have Description.

Move the contents of the PKG-INFO to a module const.

data = zf.read(requires[0])
assert data is not None
return BasicMetadata.from_sdist_pkg_info_and_requires(b"", data)
pkg_info = next(f for f in zf.namelist() if f.endswith("/PKG-INFO"))
Copy link
Member

Choose a reason for hiding this comment

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

Consider sorting this by length and taking the shortest; these might exist in test data and these archives are generally alphabetic order. I'll try to find you a real-world artifact that needs this.

Copy link
Member

@thatch thatch Nov 14, 2024

Choose a reason for hiding this comment

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

nose 1.3.1 (test data)
ucxdsa 2024.4.23 (project rename, didn't clean)
relaxed-poetry 0.2.2 (test data)
wish 1.0.1 (.lib dir)

additionally looks like rust projects don't have a top level dir

orjson 3.5.0
rfernet 0.1.3

requires_fo = tf.extractfile(requires[0])
assert requires_fo is not None
else:
requires_fo = b""
Copy link
Member

Choose a reason for hiding this comment

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

this looks like a copypaste error from the zip one, I like requires_DATA = b"" and doing the read a couple lines above rather than in the last line of this func.

@amjith amjith merged commit 9bbb7cc into main Nov 14, 2024
22 checks passed
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.

2 participants