Skip to content

fix(uv): fix handling of versions containing plus characters#898

Merged
jbedard merged 3 commits intoaspect-build:mainfrom
acozzette:version-fix
Mar 30, 2026
Merged

fix(uv): fix handling of versions containing plus characters#898
jbedard merged 3 commits intoaspect-build:mainfrom
acozzette:version-fix

Conversation

@acozzette
Copy link
Copy Markdown
Collaborator

Update uv.lock logic to account for versions containing a '+' character

Currently you get an error like this if your uv.lock contains a version with a '+' character in it:

Error in repository_rule: invalid user-provided repo name 'whl_install__mywheel__0_1+20260102': valid names may contain only A-Z, a-z, 0-9, '-', '_', '.', and must start with a letter or a number

This change fixes that by replacing '+' with an underscore in the name we generate. I tried to find all the places where this version-escaping logic occurs and update it to use a new helper function.


Changes are visible to end-users: yes

  • Searched for relevant documentation and updated as needed: yes (not needed)
  • Breaking change (forces users to change their own code or config): no
  • Suggested release notes appear below: no

Test plan

  • New test cases added

@aspect-workflows
Copy link
Copy Markdown

aspect-workflows bot commented Mar 27, 2026

Bazel 8 (Test)

All tests were cache hits

107 tests (100.0%) were fully cached saving 47s.


Bazel 9 (Test)

All tests were cache hits

107 tests (100.0%) were fully cached saving 1m 16s.


Bazel 8 (Test)

e2e

1 test target passed

Targets
//cases/uv-plus-version:test [k8-fastbuild-ST-da4f8b55c8fe]903ms

Total test execution time was 903ms. 46 tests (97.9%) were fully cached saving 55s.


Bazel 9 (Test)

e2e

1 test target passed

Targets
//cases/uv-plus-version:test [k8-fastbuild-ST-da4f8b55c8fe]1s

Total test execution time was 1s. 46 tests (97.9%) were fully cached saving 54s.


Bazel 8 (Test)

examples/uv_pip_compile

All tests were cache hits

1 test (100.0%) was fully cached saving 444ms.

@acozzette acozzette changed the title Fix handling of versions containing plus characters fix(uv): fix handling of versions containing plus characters Mar 27, 2026
Comment thread e2e/cases/uv-plus-version/__test__.py Outdated
This allows us to make the test a bit more realistic. Now the package version
truly has a plus in it, as opposed to with cowsay, where we had to artifically
introduce the plus sign in the uv.lock file.
Currently you get an error like this if your uv.lock contains a version with a
'+' character in it:
```
Error in repository_rule: invalid user-provided repo name 'whl_install__mywheel__0_1+20260102': valid names may contain only A-Z, a-z, 0-9, '-', '_', '.', and must start with a letter or a number
```

This change fixes that by replacing '+' with an underscore in the name we
generate. I tried to find all the places where this version-escaping logic
occurs and update it to use a new helper function.
@acozzette
Copy link
Copy Markdown
Collaborator Author

@jbedard Thanks! I see that pre-commit check is failing and it looks like perhaps that check expects me to have created a branch in this repo instead of in my own fork. Is that right?

@jbedard
Copy link
Copy Markdown
Member

jbedard commented Mar 30, 2026

@acozzette I'm not sure what the error is, I haven't had a chance to investigate (feel free to look if you have a chance! 😅)

But we shouldn't expect ever contributor in the world to have permission to commit to https://github.com/aspect-build/rules_py, so that would be a bug on our part if that's the issue.

@jbedard jbedard merged commit 00b4297 into aspect-build:main Mar 30, 2026
2 of 4 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.

3 participants