Skip to content

Commit 418ad70

Browse files
authored
feat: support parsing uv.lock files (#287)
1 parent 1a20a53 commit 418ad70

15 files changed

+587
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ The detector supports parsing the following lockfiles:
6868
| `gradle.lockfile` | `CRAN` | `renv` |
6969
| `mix.lock` | `Hex` | `mix` |
7070
| `poetry.lock` | `PyPI` | `poetry` |
71+
| `uv.lock` | `PyPI` | `uv` |
7172
| `Pipfile.lock` | `PyPI` | `pipenv` |
7273
| `pdm.lock` | `PyPI` | `pdm` |
7374
| `pubspec.lock` | `Pub` | `pub` |

main_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ func TestRun(t *testing.T) {
175175
pubspec.lock
176176
renv.lock
177177
requirements.txt
178+
uv.lock
178179
yarn.lock
179180
csv-file
180181
csv-row

pkg/lockfile/ecosystems_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ func TestKnownEcosystems(t *testing.T) {
3535
expectedCount := numberOfLockfileParsers(t)
3636

3737
// - npm, yarn, bun, and pnpm,
38-
// - pip, poetry, pdm and pipenv,
38+
// - pip, poetry, uv, pdm and pipenv,
3939
// - maven and gradle,
4040
// all use the same ecosystem so "ignore" those parsers in the count
41-
expectedCount -= 7
41+
expectedCount -= 8
4242

4343
ecosystems := lockfile.KnownEcosystems()
4444

pkg/lockfile/fixtures/uv/empty.lock

Whitespace-only changes.

pkg/lockfile/fixtures/uv/grouped-packages.lock

Lines changed: 220 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version = 1
2+
requires-python = ">=3.10"
3+
4+
[[package]]
5+
name = "uv-lockfiles"
6+
version = "0.1.0"
7+
source = { virtual = "." }
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version = 1
2+
requires-python = ">=3.10"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
this is not valid toml! (I think)
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version = 1
2+
requires-python = ">=3.10"
3+
4+
[[package]]
5+
name = "emoji"
6+
version = "2.14.0"
7+
source = { registry = "https://pypi.org/simple" }
8+
sdist = { url = "https://files.pythonhosted.org/packages/13/64/812d7e2ae0ac2ade0d6583f911f99240c80f700afbe8391df10e547f564d/emoji-2.14.0.tar.gz", hash = "sha256:f68ac28915a2221667cddb3e6c589303c3c6954c6c5af6fefaec7f9bdf72fdca", size = 593932 }
9+
wheels = [
10+
{ url = "https://files.pythonhosted.org/packages/ef/56/4ddf8b36aa4b52077045b17ffb8958f3360b250df4143d1482d9d5bb54d5/emoji-2.14.0-py3-none-any.whl", hash = "sha256:fcc936bf374b1aec67dda5303ae99710ba88cc9cdce2d1a71c5f2204e6d78799", size = 586897 },
11+
]
12+
13+
[[package]]
14+
name = "uv-lockfiles"
15+
version = "0.1.0"
16+
source = { virtual = "." }
17+
dependencies = [
18+
{ name = "emoji" },
19+
]
20+
21+
[package.metadata]
22+
requires-dist = [{ name = "emoji" }]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version = 1
2+
requires-python = ">=3.10"
3+
4+
[[package]]
5+
name = "ruff"
6+
version = "0.8.1"
7+
source = { git = "https://github.com/astral-sh/ruff#84748be16341b76e073d117329f7f5f4ee2941ad" }
8+
9+
[[package]]
10+
name = "uv-lockfiles"
11+
version = "0.1.0"
12+
source = { virtual = "." }
13+
dependencies = [
14+
{ name = "ruff" },
15+
]
16+
17+
[package.metadata]
18+
requires-dist = [{ name = "ruff", git = "https://github.com/astral-sh/ruff" }]

0 commit comments

Comments
 (0)