mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-07-28 08:41:40 +00:00
Ignore backslashes and whitespace in requirements (#501)
Some checks failed
test / test-musl (push) Failing after 3s
test / test-default-version (ubuntu-latest) (push) Successful in 35s
test / test-malformed-pyproject-file-fallback (push) Successful in 34s
test / test-specific-version (0.3.2) (push) Successful in 39s
test / test-uv-file-version (push) Successful in 35s
test / test-version-file-hash-version (push) Successful in 37s
test / test-pep440-version (push) Successful in 42s
test / test-semver-range (ubuntu-latest) (push) Successful in 54s
test / test-specific-version (0.3) (push) Successful in 59s
test / test-uvx (push) Successful in 52s
test / test-specific-version (0.3.x) (push) Successful in 1m0s
test / test-cache-local (map[expected-cache-dir:/home/runner/work/_temp/setup-uv-cache os:ubuntu-latest]) (push) Failing after 49s
test / test-checksum (map[checksum:4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd os:ubuntu-latest]) (push) Successful in 1m1s
test / test-absolute-path (push) Successful in 55s
test / test-tool-install (ubuntu-latest) (push) Successful in 1m3s
test / test-setup-cache (false, ubuntu-latest) (push) Successful in 1m1s
CodeQL / Analyze (TypeScript) (push) Failing after 1m29s
test / test-setup-cache-dependency-glob (push) Successful in 1m25s
test / test-pyproject-file-version (push) Successful in 1m50s
test / test-restore-cache-dependency-glob (push) Successful in 1m6s
test / test-custom-manifest-file (push) Successful in 2m31s
test / test-setup-cache (true, ubuntu-latest) (push) Failing after 4m26s
test / test-activate-environment (ubuntu-latest) (push) Failing after 7m45s
test / lint (push) Failing after 10m26s
test / test-specific-version (0.3.0) (push) Successful in 17m12s
test / test-no-python-version (push) Failing after 24m25s
test / test-setup-cache (auto, ubuntu-latest) (push) Successful in 26m45s
test / test-python-version (ubuntu-latest) (push) Failing after 28m10s
test / test-relative-path (push) Failing after 33m5s
test / test-specific-version (>=0.3.0) (push) Successful in 36m21s
test / test-setup-cache-requirements-txt (push) Successful in 37m36s
test / test-with-explicit-token (push) Successful in 38m26s
test / test-version-file-version (push) Failing after 3h14m0s
Release Drafter / ✏️ Draft release (push) Has been cancelled
test / test-checksum (map[checksum:a70cbfbf3bb5c08b2f84963b4f12c94e08fbb2468ba418a3bfe1066fbe9e7218 os:macos-latest]) (push) Has been cancelled
test / test-tool-install (macos-14) (push) Has been cancelled
test / test-tool-install (macos-latest) (push) Has been cancelled
test / test-tool-install (windows-latest) (push) Has been cancelled
test / test-default-version (macos-14) (push) Has been cancelled
test / test-default-version (macos-latest) (push) Has been cancelled
test / test-default-version (windows-latest) (push) Has been cancelled
test / test-semver-range (selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-tilde-expansion-tool-dirs (push) Has been cancelled
test / test-python-version (macos-latest) (push) Has been cancelled
test / test-python-version (windows-latest) (push) Has been cancelled
test / test-activate-environment (macos-latest) (push) Has been cancelled
test / test-setup-cache (false, windows-latest) (push) Has been cancelled
test / test-activate-environment (windows-latest) (push) Has been cancelled
test / test-setup-cache (auto, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-setup-cache (auto, windows-latest) (push) Has been cancelled
test / test-setup-cache (false, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-setup-cache (true, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-setup-cache (true, windows-latest) (push) Has been cancelled
test / test-cache-local (map[expected-cache-dir:/home/ubuntu/.cache/uv os:selfhosted-ubuntu-arm64]) (push) Has been cancelled
test / test-cache-local (map[expected-cache-dir:D:\a\_temp\setup-uv-cache os:windows-latest]) (push) Has been cancelled
test / test-setup-cache-local (push) Has been cancelled
test / test-tilde-expansion-cache-local-path (push) Has been cancelled
test / test-tilde-expansion-cache-dependency-glob (push) Has been cancelled
test / test-restore-cache (auto, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-restore-cache (auto, ubuntu-latest) (push) Has been cancelled
test / test-restore-cache (auto, windows-latest) (push) Has been cancelled
test / test-restore-cache (false, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-restore-cache (false, ubuntu-latest) (push) Has been cancelled
test / test-restore-cache (false, windows-latest) (push) Has been cancelled
test / test-restore-cache (true, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-restore-cache (true, ubuntu-latest) (push) Has been cancelled
test / test-restore-cache (true, windows-latest) (push) Has been cancelled
test / test-restore-cache-local (push) Has been cancelled
test / cleanup-tilde-expansion-tests (push) Has been cancelled
test / all-tests-passed (push) Has been cancelled
test / test-restore-cache-requirements-txt (push) Has been cancelled
Update known versions / build (push) Has been cancelled
Some checks failed
test / test-musl (push) Failing after 3s
test / test-default-version (ubuntu-latest) (push) Successful in 35s
test / test-malformed-pyproject-file-fallback (push) Successful in 34s
test / test-specific-version (0.3.2) (push) Successful in 39s
test / test-uv-file-version (push) Successful in 35s
test / test-version-file-hash-version (push) Successful in 37s
test / test-pep440-version (push) Successful in 42s
test / test-semver-range (ubuntu-latest) (push) Successful in 54s
test / test-specific-version (0.3) (push) Successful in 59s
test / test-uvx (push) Successful in 52s
test / test-specific-version (0.3.x) (push) Successful in 1m0s
test / test-cache-local (map[expected-cache-dir:/home/runner/work/_temp/setup-uv-cache os:ubuntu-latest]) (push) Failing after 49s
test / test-checksum (map[checksum:4d9279ad5ca596b1e2d703901d508430eb07564dc4d8837de9e2fca9c90f8ecd os:ubuntu-latest]) (push) Successful in 1m1s
test / test-absolute-path (push) Successful in 55s
test / test-tool-install (ubuntu-latest) (push) Successful in 1m3s
test / test-setup-cache (false, ubuntu-latest) (push) Successful in 1m1s
CodeQL / Analyze (TypeScript) (push) Failing after 1m29s
test / test-setup-cache-dependency-glob (push) Successful in 1m25s
test / test-pyproject-file-version (push) Successful in 1m50s
test / test-restore-cache-dependency-glob (push) Successful in 1m6s
test / test-custom-manifest-file (push) Successful in 2m31s
test / test-setup-cache (true, ubuntu-latest) (push) Failing after 4m26s
test / test-activate-environment (ubuntu-latest) (push) Failing after 7m45s
test / lint (push) Failing after 10m26s
test / test-specific-version (0.3.0) (push) Successful in 17m12s
test / test-no-python-version (push) Failing after 24m25s
test / test-setup-cache (auto, ubuntu-latest) (push) Successful in 26m45s
test / test-python-version (ubuntu-latest) (push) Failing after 28m10s
test / test-relative-path (push) Failing after 33m5s
test / test-specific-version (>=0.3.0) (push) Successful in 36m21s
test / test-setup-cache-requirements-txt (push) Successful in 37m36s
test / test-with-explicit-token (push) Successful in 38m26s
test / test-version-file-version (push) Failing after 3h14m0s
Release Drafter / ✏️ Draft release (push) Has been cancelled
test / test-checksum (map[checksum:a70cbfbf3bb5c08b2f84963b4f12c94e08fbb2468ba418a3bfe1066fbe9e7218 os:macos-latest]) (push) Has been cancelled
test / test-tool-install (macos-14) (push) Has been cancelled
test / test-tool-install (macos-latest) (push) Has been cancelled
test / test-tool-install (windows-latest) (push) Has been cancelled
test / test-default-version (macos-14) (push) Has been cancelled
test / test-default-version (macos-latest) (push) Has been cancelled
test / test-default-version (windows-latest) (push) Has been cancelled
test / test-semver-range (selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-tilde-expansion-tool-dirs (push) Has been cancelled
test / test-python-version (macos-latest) (push) Has been cancelled
test / test-python-version (windows-latest) (push) Has been cancelled
test / test-activate-environment (macos-latest) (push) Has been cancelled
test / test-setup-cache (false, windows-latest) (push) Has been cancelled
test / test-activate-environment (windows-latest) (push) Has been cancelled
test / test-setup-cache (auto, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-setup-cache (auto, windows-latest) (push) Has been cancelled
test / test-setup-cache (false, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-setup-cache (true, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-setup-cache (true, windows-latest) (push) Has been cancelled
test / test-cache-local (map[expected-cache-dir:/home/ubuntu/.cache/uv os:selfhosted-ubuntu-arm64]) (push) Has been cancelled
test / test-cache-local (map[expected-cache-dir:D:\a\_temp\setup-uv-cache os:windows-latest]) (push) Has been cancelled
test / test-setup-cache-local (push) Has been cancelled
test / test-tilde-expansion-cache-local-path (push) Has been cancelled
test / test-tilde-expansion-cache-dependency-glob (push) Has been cancelled
test / test-restore-cache (auto, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-restore-cache (auto, ubuntu-latest) (push) Has been cancelled
test / test-restore-cache (auto, windows-latest) (push) Has been cancelled
test / test-restore-cache (false, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-restore-cache (false, ubuntu-latest) (push) Has been cancelled
test / test-restore-cache (false, windows-latest) (push) Has been cancelled
test / test-restore-cache (true, selfhosted-ubuntu-arm64) (push) Has been cancelled
test / test-restore-cache (true, ubuntu-latest) (push) Has been cancelled
test / test-restore-cache (true, windows-latest) (push) Has been cancelled
test / test-restore-cache-local (push) Has been cancelled
test / cleanup-tilde-expansion-tests (push) Has been cancelled
test / all-tests-passed (push) Has been cancelled
test / test-restore-cache-requirements-txt (push) Has been cancelled
Update known versions / build (push) Has been cancelled
setup-uv gets confused when there are backslashes in `requirements.txt`. This changes the regex to ignore backslashes. --------- Co-authored-by: axm2 <>
This commit is contained in:
17
.github/workflows/test.yml
vendored
17
.github/workflows/test.yml
vendored
@ -171,6 +171,22 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
test-version-file-hash-version:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Install from requirements file
|
||||||
|
id: setup-uv
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
version-file: "__tests__/fixtures/uv-in-requirements-hash-txt-project/requirements.txt"
|
||||||
|
- name: Correct version gets installed
|
||||||
|
run: |
|
||||||
|
if [ "$(uv --version)" != "uv 0.8.3" ]; then
|
||||||
|
echo "Wrong uv version: $(uv --version)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
test-checksum:
|
test-checksum:
|
||||||
runs-on: ${{ matrix.inputs.os }}
|
runs-on: ${{ matrix.inputs.os }}
|
||||||
strategy:
|
strategy:
|
||||||
@ -618,6 +634,7 @@ jobs:
|
|||||||
- test-malformed-pyproject-file-fallback
|
- test-malformed-pyproject-file-fallback
|
||||||
- test-uv-file-version
|
- test-uv-file-version
|
||||||
- test-version-file-version
|
- test-version-file-version
|
||||||
|
- test-version-file-hash-version
|
||||||
- test-checksum
|
- test-checksum
|
||||||
- test-with-explicit-token
|
- test-with-explicit-token
|
||||||
- test-uvx
|
- test-uvx
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
print("Hello world")
|
@ -0,0 +1,33 @@
|
|||||||
|
# This file was autogenerated by uv via the following command:
|
||||||
|
# uv pip compile --generate-hashes - -o ex-requirements.txt
|
||||||
|
click==8.2.1 \
|
||||||
|
--hash=sha256:27c491cc05d968d271d5a1db13e3b5a184636d9d930f148c50b038f0d0646202 \
|
||||||
|
--hash=sha256:61a3265b914e850b85317d0b3109c7f8cd35a670f963866005d6ef1d5175a12b
|
||||||
|
# via uvicorn
|
||||||
|
h11==0.16.0 \
|
||||||
|
--hash=sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1 \
|
||||||
|
--hash=sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86
|
||||||
|
# via uvicorn
|
||||||
|
uv==0.8.3 \
|
||||||
|
--hash=sha256:1121ad1c9389b865d029385031d3fd7d90d343c92a2149a4d4aa20bf469cb27f \
|
||||||
|
--hash=sha256:17bcdb0615e37cc5f985f7d7546f755ac6343c1dc8bbe876c892437f14f8f904 \
|
||||||
|
--hash=sha256:2ccaae4c749126c99f6404d67a0ae1eae29cbafb05603d09094a775061fdf4e5 \
|
||||||
|
--hash=sha256:2e311c029bff2ca07c6ddf877ccc5935cabb78e09b94b53a849542665b6a6fa1 \
|
||||||
|
--hash=sha256:391c97577048a40fd8c85b370055df6420f26e81df7fa906f0e0ce1aa2af3527 \
|
||||||
|
--hash=sha256:3f904f574dc2d7aa1d96ddf2483480ecd121dc9d060108cadd8bff100b754b64 \
|
||||||
|
--hash=sha256:526f2c3bd6f311ce31f6f7b6b7d818b191f41e76bed3aaab671b716220c02d8f \
|
||||||
|
--hash=sha256:5313ee776ad65731ffa8ac585246f987d3a2bf72e6153c12add1fff22ad6e500 \
|
||||||
|
--hash=sha256:5843cc43bafad05cc710d8e31bd347ee37202462a63d32c30746e9df48cfbda2 \
|
||||||
|
--hash=sha256:76de331a07e5ae9b6490e70a9439a072b91b3167a5684510af10c2752c4ece9a \
|
||||||
|
--hash=sha256:8486f7576d15cc73509f93f47b3190f44701ea36839906369301b58c8604d5db \
|
||||||
|
--hash=sha256:8b16f1bddfdf8f7470924ab34a7b55e4c372d5340c7c1e47e7fc84a743dc541f \
|
||||||
|
--hash=sha256:966ec7d7f57521fef0fee685d71e183c9cafb358ddcfe27519dfeaf40550f247 \
|
||||||
|
--hash=sha256:989898caeb6e972979543b57547d1c28ab8af81ff8fc15921fd354c17d432749 \
|
||||||
|
--hash=sha256:9ce7981f4fbeecf93dc5cf0a5a7915e84956fd99ad3ac977c048fe0cfdb1a17e \
|
||||||
|
--hash=sha256:ad13453ab0a1dfa64a221aac8f52199efdcaa52c97134fffd7bcebed794a6f4b \
|
||||||
|
--hash=sha256:ae7efe91dcfc24126fa91e0fb69a1daf6c0e494a781ba192bb0cc62d7ab623ee \
|
||||||
|
--hash=sha256:daa6e0d657a94f20e962d4a03d833ef7af5c8e51b7c8a2d92ba6cf64a4c07ac1 \
|
||||||
|
--hash=sha256:f1eb7c896fc0d80ed534748aaf46697b6ebc8ce401f1c51666ce0b9923c3db9a
|
||||||
|
uvicorn==0.35.0 \
|
||||||
|
--hash=sha256:197535216b25ff9b785e29a0b79199f55222193d47f820816e7da751e9bc8d4a \
|
||||||
|
--hash=sha256:bc662f087f7cf2ce11a1d7fd70b90c9f98ef2e2831556dd078d131b96cc94a01
|
10
__tests__/version/requirements-hashes-file.test.ts
Normal file
10
__tests__/version/requirements-hashes-file.test.ts
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import { getUvVersionFromFile } from "../../src/version/resolve";
|
||||||
|
|
||||||
|
import { expect, test } from "@jest/globals";
|
||||||
|
|
||||||
|
test("ignores dependencies starting with uv", async () => {
|
||||||
|
const parsedVersion = getUvVersionFromFile(
|
||||||
|
"__tests__/fixtures/uv-in-requirements-hash-txt-project/requirements.txt",
|
||||||
|
);
|
||||||
|
expect(parsedVersion).toBe("0.8.3");
|
||||||
|
});
|
2
dist/setup/index.js
generated
vendored
2
dist/setup/index.js
generated
vendored
@ -125910,7 +125910,7 @@ function getUvVersionFromRequirementsFile(filePath) {
|
|||||||
function getUvVersionFromAllDependencies(allDependencies) {
|
function getUvVersionFromAllDependencies(allDependencies) {
|
||||||
return allDependencies
|
return allDependencies
|
||||||
.find((dep) => dep.match(/^uv[=<>~!]/))
|
.find((dep) => dep.match(/^uv[=<>~!]/))
|
||||||
?.match(/^uv([=<>~!]+.*)$/)?.[1]
|
?.match(/^uv([=<>~!]+\S*)/)?.[1]
|
||||||
.trim();
|
.trim();
|
||||||
}
|
}
|
||||||
function parsePyprojectDependencies(pyprojectContent) {
|
function parsePyprojectDependencies(pyprojectContent) {
|
||||||
|
@ -16,7 +16,7 @@ function getUvVersionFromAllDependencies(
|
|||||||
): string | undefined {
|
): string | undefined {
|
||||||
return allDependencies
|
return allDependencies
|
||||||
.find((dep: string) => dep.match(/^uv[=<>~!]/))
|
.find((dep: string) => dep.match(/^uv[=<>~!]/))
|
||||||
?.match(/^uv([=<>~!]+.*)$/)?.[1]
|
?.match(/^uv([=<>~!]+\S*)/)?.[1]
|
||||||
.trim();
|
.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user