Ignore deps starting with uv when finding uv version (#492)

Fixes: #489
This commit is contained in:
Kevin Stillhammer
2025-07-18 08:10:43 +02:00
committed by GitHub
parent 05273c154d
commit 7edac99f96
4 changed files with 15 additions and 4 deletions

View File

@ -1 +1,2 @@
uvicorn==0.35.0
uv==0.6.17

View 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-txt-project/requirements.txt",
);
expect(parsedVersion).toBe("0.6.17");
});

4
dist/setup/index.js generated vendored
View File

@ -125802,8 +125802,8 @@ function getUvVersionFromRequirementsFile(filePath) {
}
function getUvVersionFromAllDependencies(allDependencies) {
return allDependencies
.find((dep) => dep.startsWith("uv"))
?.match(/^uv([^A-Z0-9._-]+.*)$/)?.[1]
.find((dep) => dep.match(/^uv[=<>~!]/))
?.match(/^uv([=<>~!]+.*)$/)?.[1]
.trim();
}
function parsePyprojectDependencies(pyprojectContent) {

View File

@ -15,8 +15,8 @@ function getUvVersionFromAllDependencies(
allDependencies: string[],
): string | undefined {
return allDependencies
.find((dep: string) => dep.startsWith("uv"))
?.match(/^uv([^A-Z0-9._-]+.*)$/)?.[1]
.find((dep: string) => dep.match(/^uv[=<>~!]/))
?.match(/^uv([=<>~!]+.*)$/)?.[1]
.trim();
}