GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: percent-decode pylock file names derived from url by atsuoishimoto · Pull Request #1314 · pypa/packaging

Conversation

@atsuoishimoto

@atsuoishimoto atsuoishimoto commented Jul 5, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

In a uv project like the following, running pip wheel -r pylocl.toml with pip 26.1.2 fails:

[project]
name = "project"
version = "0.1.0"
requires-python = ">=3.14.0"
dependencies = [
  "torch>=2.11.0",
]

[tool.uv.sources]
torch = [
    { index = "pytorch-cpu" },
]

[[tool.uv.index]]
name = "pytorch-cpu"
url = "https://download.pytorch.org/whl/cpu"
explicit = true
$ uv export --format pylock.toml > pylock.toml
$ python3.14 -m pip wheel -r pylock.toml

WARNING: Using pylock.toml as a requirements source is an experimental feature. It may be removed/changed in a future release without prior warning.
ERROR: Invalid pylock file 'pylock.toml': Invalid wheel filename 'torch-2.12.1%2Bcpu-cp314-cp314-linux_s390x.whl' in 'packages[9].wheels[0]'

In some cases, uv omits the optional artifact name field. pip then derives the filename from the URL basename using packaging.pylock._url_name, but the basename is not percent-decoded. As a result, wheels with local versions such as 2.12.1+cu130, where + is encoded as %2B in the URL, are rejected as invalid wheel filenames.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

lets-build-an-ocean reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@atsuoishimoto
Percent-decode pylock file names derived from url
9d89093
Local versions like 2.12.1+cu130 are encoded as 2.12.1%2Bcu130 in a
url; decode the basename so the resulting wheel/sdist file name is
valid.
@atsuoishimoto
atsuoishimoto marked this pull request as ready for review July 5, 2026 23:39
@atsuoishimoto atsuoishimoto mentioned this pull request Jul 6, 2026
Preserve per-package index pins by exporting uv locks as PEP 751 pylock.toml atsuoishimoto/pyappdist#52
Merged
@lets-build-an-ocean

lets-build-an-ocean commented Jul 6, 2026

Copy link
Copy Markdown

LGTM 👍🏻

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@henryiii
henryiii requested a review from sbidoul July 6, 2026 21:59
@sbidoul

sbidoul commented Jul 7, 2026

Copy link
Copy Markdown
Member

Interesting. What does the pylock spec say about % encoding of urls?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@atsuoishimoto

atsuoishimoto commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

The url is only specified as a URL as defined by https://url.spec.whatwg.org/, and there are no special requirements regarding escaping.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@atsuoishimoto

atsuoishimoto commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

I do not think pylock needs any special escaping rule here; this follows from treating the field as a URL and then converting the URL path component back to a filename.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@henryiii

henryiii commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

FWIW, I think this looks correct. @brettcannon?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@atsuoishimoto
Merge branch 'main' into fix-pylock-url-decode-2026-07-05-07-39-55
3ada300
sbidoul
sbidoul approved these changes Jul 15, 2026
View reviewed changes

@sbidoul sbidoul left a comment

Copy link
Copy Markdown
Member

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.

Looked at this closer. Sounds good.

I have mild worries about double decoding, but maybe it's obvious from the URL spec that tools must encode URLs when writing pylock.toml.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@henryiii

henryiii commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

I verified uv writes percent encoded lock files when exporting.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

henryiii
henryiii approved these changes Jul 17, 2026
View reviewed changes
@henryiii henryiii changed the title Percent-decode pylock file names derived from url fix: percent-decode pylock file names derived from url Jul 17, 2026
brettcannon
brettcannon approved these changes Jul 17, 2026
View reviewed changes
@brettcannon
brettcannon merged commit 6f52c6b into pypa:main Jul 17, 2026
69 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@r266-tech r266-tech mentioned this pull request Jul 18, 2026
fix: validate sdist names and wheel build components #1337
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@brettcannon brettcannon brettcannon approved these changes
@henryiii henryiii henryiii approved these changes
+1 more reviewer
@sbidoul sbidoul sbidoul approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@atsuoishimoto @lets-build-an-ocean @sbidoul @henryiii @brettcannon
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.