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:
2026-10-22 04:05:31 +00:00
parent 5db454f8c8
commit 63c5497a83
3 changed files with 13 additions and 12 deletions
+2 -7
View File
@@ -1,4 +1,3 @@
.gitignore
.venv/ .venv/
__pycache__/ __pycache__/
*.py[cod] *.py[cod]
@@ -7,15 +6,11 @@ __pycache__/
.mypy_cache/ .mypy_cache/
.env .env
.env.* .env.*
docker-compose*.yml
Dockerfile
.dockerignore
*.md
!README.md
xmcp.yml xmcp.yml
xmcp.example.yml xmcp.local.yml
# Generated at build time # Generated at build time
src/xmcp/_version.py src/xmcp/_version.py
*.egg-info/ *.egg-info/
build/
dist/ dist/
+4 -5
View File
@@ -20,11 +20,10 @@ COPY pyproject.toml uv.lock .python-version ./
RUN --mount=type=cache,target=/root/.cache/uv \ RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev --no-install-project uv sync --frozen --no-dev --no-install-project
# Then install the project itself as a regular wheel. The git metadata is # Then install the project itself. The full checkout (including .git) is
# required by setuptools-scm to derive the package version. # copied so setuptools-scm sees a clean worktree and derives the version
COPY README.md ./ # from the closest release tag.
COPY src ./src COPY . .
COPY .git ./.git
RUN --mount=type=cache,target=/root/.cache/uv \ RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --frozen --no-dev --no-editable uv sync --frozen --no-dev --no-editable
+7
View File
@@ -25,3 +25,10 @@ version_file = "src/xmcp/_version.py"
[tool.setuptools_scm.tag] [tool.setuptools_scm.tag]
prefix = "release/" 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 } },
]