-
Notifications
You must be signed in to change notification settings - Fork 1
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
generate a multi-level PyPi index as per PEP 503 #1
base: main
Are you sure you want to change the base?
Conversation
I tried to solve with dumb-pypi, but that tool cannot handle asset URLs which do not share the same prefix. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me, thanks for picking it up
|
||
def main(args): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--url-path-prefix", default="/", action="store") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My read of pep-0503 is that the URLs must always be exactly /<project>/
, i.e. customising this --url-path-prefix
value may not work at all, and so potentially shouldn't be exposed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My read of PEP 503 is that they are the full path with trailing /
. And checking PyPi itself shows that the links include the prefix since they are /simple/PKG_NAME/
. (For example, look at curl https://pypi.org/simple/ -o pypi.html
.)
packages = defaultdict(lambda: defaultdict(list)) | ||
|
||
for asset in pants_wheel_assets: | ||
name, version, build_tag, tags = parse_wheel_filename(asset.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PEP 503 seems to suggest we MUST be using the normalised names in various places. Does this guarantee name
is the normalised package name? Or maybe the wheel file names are guaranteed to be normalised?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the normalized name is returned: https://packaging.pypa.io/en/stable/utils.html#packaging.utils.parse_wheel_filename
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious what prompted this?
Slack request from a user: https://pantsbuild.slack.com/archives/C046T6T9U/p1732700284097479 |
I pulled the test out to #2 and added a GitHub Actions workflow for it. Once that other PR lands, I'll update this PR accordingly. |
676e8e3
to
31acff8
Compare
@huonw / @benjyw: scie-pants has a reference to the single index file on Is this something which has the potential to break if this PR lands? |
Back to draft to prevent landing this PR until after we determine any effects on scie-pants. |
Ah, hm, good question. I suspect it's probably fine for new versions of scie-pants: a few lines later it is suggested that code path is only used for pants < 2, and I think this index file only supports pants >= 2, so the wheels referenced here shouldn't be useful. Things I don't know:
|
|
Yeah, in theory it does: one-stop-shop for running all Pantses. There's even a test of running 1.30.5rc1: https://github.com/pantsbuild/scie-pants/blob/be453bb700dfe1728efdc41a68c41c266144bc58/package/src/test.rs#L830-L851 In practice, just now, I've not been able to get this running locally (e.g. in a x86-64 linux docker container) due to errors like:
The version of pip mentioned there seems to come from https://github.com/pantsbuild/scie-pants/blob/be453bb700dfe1728efdc41a68c41c266144bc58/tools/src/scie_pants/install_pants.py#L70 I've posted pantsbuild/scie-pants#431 to simulate this change and see what scie-pants' CI says. |
I'd definitely like to understand the full implications before merging. Can we not generate both indexes? The new one can go to some new location, since people who want to use it are aware of it. That said, scie-pants could perhaps also benefit from the faster lookup? |
PEP 503 describes a multi-level PyPi index with a root index file with just links to the supported "projects" and project-specific index files with the actual links to release files.
Update
generate_index.py
to generate a multi-level index and modify the test accordingly.