Skip to content

Commit 8e8ef34

Browse files
committed
chore: Run uv lock with updated pyproject.toml in sdist
1 parent d69f6b4 commit 8e8ef34

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

pdm_build.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from pathlib import Path
2+
from shutil import copy
3+
from subprocess import run
4+
5+
from pdm.backend.hooks import Context
6+
7+
8+
def pdm_build_update_files(context: Context, files: dict[str, Path]) -> None:
9+
if context.target == "sdist":
10+
context.ensure_build_dir()
11+
copy(files["uv.lock"], context.build_dir / "uv.lock")
12+
context.config.write_to(context.build_dir / "pyproject.toml")
13+
run(["uv", "lock"], cwd=context.build_dir, check=True)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["pdm-backend"]
2+
requires = ["pdm-backend", "uv"]
33
build-backend = "pdm.backend"
44

55
[project]

0 commit comments

Comments
 (0)