Skip to content

Commit ee94672

Browse files
authored
Merge pull request #10 from umago/migrate-pdm-to-uv
Migrate from PDM to UV
2 parents 41e2192 + a12ce6b commit ee94672

7 files changed

Lines changed: 2029 additions & 2156 deletions

File tree

.dockerignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ __pycache__
1212
*.so
1313
.venv
1414
venv
15-
.pdm-python
16-
.pdm-build
15+
.python-version
1716

1817
# Tests and dev
1918
tests

.gitignore

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,8 @@ ipython_config.py
111111
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
112112
#poetry.lock
113113

114-
# pdm
115-
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
116-
#pdm.lock
117-
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
118-
# in version control.
119-
# https://pdm-project.org/#use-with-ide
120-
.pdm.toml
121-
.pdm-python
122-
.pdm-build/
114+
# uv
115+
# uv.lock should be committed to version control for reproducible builds.
123116

124117
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
125118
__pypackages__/

Containerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@ FROM registry.access.redhat.com/ubi9/python-312:latest AS builder
22

33
WORKDIR /app
44

5-
# Install PDM in the builder only; not needed in the final image.
6-
RUN pip install --no-cache-dir pdm
5+
# Install uv in the builder only; not needed in the final image.
6+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
77

88
# Copy dependency manifests and README first (build backend needs README.md).
99
# Dependency layer is reused when only application code changes.
10-
COPY pyproject.toml pdm.lock README.md ./
11-
RUN pdm install --prod --no-editable --frozen-lockfile
10+
COPY pyproject.toml uv.lock README.md ./
11+
RUN uv sync --frozen --no-dev --no-editable --no-install-project
1212

1313
# Copy application code and install the package into the venv.
1414
COPY src/ src/
15-
RUN pdm install --prod --no-editable --frozen-lockfile
15+
RUN uv sync --frozen --no-dev --no-editable
1616

1717
RUN curl -o oc.tar.gz https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable-4.18/openshift-client-linux.tar.gz && \
1818
tar xvf oc.tar.gz oc && \
1919
chmod +x oc && \
2020
rm oc.tar.gz
2121

22-
# Final stage: smaller image without PDM or build tools.
22+
# Final stage: smaller image without uv or build tools.
2323
FROM registry.access.redhat.com/ubi9/python-312:latest
2424

2525
LABEL com.redhat.component="rhos-ls-mcps" \

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,13 @@ We assume the configuration file has already been created, for example `config.y
127127
## From source code
128128

129129
```bash
130-
pdm run rhos-ls-mcps
130+
uv run rhos-ls-mcps
131+
```
132+
133+
To run with environment variables (e.g. debug mode):
134+
135+
```bash
136+
DEBUG=1 uv run rhos-ls-mcps
131137
```
132138

133139
## Container Image

pdm.lock

Lines changed: 0 additions & 2126 deletions
This file was deleted.

pyproject.toml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,8 @@ readme = "README.md"
1919
license = {text = "Apache-2.0"}
2020

2121
[build-system]
22-
requires = ["pdm-backend"]
23-
build-backend = "pdm.backend"
24-
25-
[tool.pdm]
26-
distribution = true
22+
requires = ["uv_build>=0.11.16,<0.12"]
23+
build-backend = "uv_build"
2724

2825
[project.scripts]
2926
rhos-ls-mcps = "rhos_ls_mcps.main:main"
30-
31-
#[project.scriptspdm.scripts.rhos-ls-mcps]
32-
#env = { DEBUG = "1" }
33-
#cmd = "python -m rhos_ls_mcps.main"
34-
#cmd = ["python", "-m", "rhos_ls_mcps.main"]
35-
# env = { TYPE = "dev", PORT = "5000" }
36-
# rhos-ls-mcps = { call = "rhos_ls_mcps.main" }

uv.lock

Lines changed: 2011 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)