build: let uv track git version changes; copy full checkout in Docker
Add uv cache-keys for the commit and tags so the editable install is refreshed when the git state changes, and copy the complete checkout (with .git) into the builder so setuptools-scm sees a clean worktree. Previously the partial copy made git describe report a dirty tree and tagged Docker builds got a development version suffix.
This commit is contained in:
+2
-7
@@ -1,4 +1,3 @@
|
||||
.gitignore
|
||||
.venv/
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
@@ -7,15 +6,11 @@ __pycache__/
|
||||
.mypy_cache/
|
||||
.env
|
||||
.env.*
|
||||
docker-compose*.yml
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
*.md
|
||||
!README.md
|
||||
xmcp.yml
|
||||
xmcp.example.yml
|
||||
xmcp.local.yml
|
||||
|
||||
# Generated at build time
|
||||
src/xmcp/_version.py
|
||||
*.egg-info/
|
||||
build/
|
||||
dist/
|
||||
|
||||
+4
-5
@@ -20,11 +20,10 @@ COPY pyproject.toml uv.lock .python-version ./
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
uv sync --frozen --no-dev --no-install-project
|
||||
|
||||
# Then install the project itself as a regular wheel. The git metadata is
|
||||
# required by setuptools-scm to derive the package version.
|
||||
COPY README.md ./
|
||||
COPY src ./src
|
||||
COPY .git ./.git
|
||||
# Then install the project itself. The full checkout (including .git) is
|
||||
# copied so setuptools-scm sees a clean worktree and derives the version
|
||||
# from the closest release tag.
|
||||
COPY . .
|
||||
RUN --mount=type=cache,target=/root/.cache/uv \
|
||||
uv sync --frozen --no-dev --no-editable
|
||||
|
||||
|
||||
@@ -25,3 +25,10 @@ version_file = "src/xmcp/_version.py"
|
||||
|
||||
[tool.setuptools_scm.tag]
|
||||
prefix = "release/"
|
||||
|
||||
[tool.uv]
|
||||
# setuptools-scm derives the version from git; make uv notice commit/tag changes.
|
||||
cache-keys = [
|
||||
{ file = "pyproject.toml" },
|
||||
{ git = { commit = true, tags = true } },
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user