Skip to content

Commit 407cc22

Browse files
author
saville
committed
Migrate project to uv
1 parent befd6d9 commit 407cc22

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2133
-748
lines changed

.github/workflows/build.yaml

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,29 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
python-version:
20-
- 3.9
20+
- '3.9'
2121
- '3.10'
2222
- '3.11'
2323
- '3.12'
24+
- '3.13'
2425
steps:
2526
- uses: actions/checkout@v2
26-
- name: Set up Python ${{ matrix.python-version }}
27-
uses: actions/setup-python@v2
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v6
2829
with:
2930
python-version: ${{ matrix.python-version }}
31+
# Install dev dependencies
3032
- name: Install dependencies
31-
run: |
32-
python -m pip install --upgrade pip
33-
pip install -r requirements.txt
34-
pip install -r test_requirements.txt
33+
run: uv sync --locked
3534
- name: Pre-commit checks
36-
run: pre-commit run --all-files
35+
run: uv run pre-commit run --all-files
3736
- name: Test with pytest
3837
# Create the ssh key file once for all testing
3938
run: |
4039
ssh-keygen -t ecdsa -m PEM -N '' -f /tmp/buildrunner-test-id_rsa
41-
pytest -v -m "not serial" --numprocesses=auto --junitxml=test-reports/non-serial-test-results.xml
42-
pytest -v -m "serial" --junitxml=test-reports/serial-test-results.xml
43-
python scripts/combine_xml.py test-reports/serial-test-results.xml test-reports/non-serial-test-results.xml > test-reports/test-result.xml
40+
uv run pytest -v -m "not serial" --numprocesses=auto --junitxml=test-reports/non-serial-test-results.xml
41+
uv run pytest -v -m "serial" --junitxml=test-reports/serial-test-results.xml
42+
uv run python scripts/combine_xml.py test-reports/serial-test-results.xml test-reports/non-serial-test-results.xml > test-reports/test-result.xml
4443
- name: Publish test results
4544
uses: EnricoMi/publish-unit-test-result-action/linux@v2
4645
if: always()
@@ -60,15 +59,15 @@ jobs:
6059
with:
6160
# Fetch all history instead of the latest commit
6261
fetch-depth: 0
62+
- name: Install uv
63+
uses: astral-sh/setup-uv@v6
64+
with:
65+
python-version: 3.9
6366
- name: Install dependencies
64-
run: |
65-
python -m pip install --upgrade pip
66-
pip install -r requirements.txt
67-
- name: Write version file
68-
run: python scripts/write-version.py
67+
run: uv sync --locked
6968
- name: Get current version
7069
id: version-number
71-
run: echo "CURRENT_VERSION=$( python -c 'from buildrunner.version import __version__; print(__version__)' )" >> $GITHUB_OUTPUT
70+
run: echo "CURRENT_VERSION=$(uv version --short).$(git rev-list --count HEAD)" >> $GITHUB_OUTPUT
7271
- name: Print current version
7372
run: echo CURRENT_VERSION ${{ steps.version-number.outputs.CURRENT_VERSION }}
7473
tag-commit:
@@ -91,24 +90,18 @@ jobs:
9190
with:
9291
# Fetch all history instead of the latest commit
9392
fetch-depth: 0
94-
- name: Set up Python
95-
uses: actions/setup-python@v2
93+
- name: Install uv
94+
uses: astral-sh/setup-uv@v6
9695
with:
9796
python-version: 3.9
9897
- name: Install dependencies
99-
run: |
100-
python -m pip install --upgrade pip
101-
pip install -r requirements.txt
102-
pip install wheel build
103-
- name: Remove version file
104-
# This is just in case something else created it, destroy it to get a fresh version
105-
run: rm -f buildrunner/version.py
106-
- name: Write version file
107-
run: python scripts/write-version.py
98+
run: uv sync --locked
99+
- name: Set version
100+
run: uv version --no-sync "$(uv version --short).$(git rev-list --count HEAD)"
108101
- name: Build
109-
run: python -m build
102+
run: uv build
110103
- name: Check upload
111-
run: pip install twine && twine check dist/*
104+
run: uv run --with twine twine check dist/*
112105
- name: Publish to PyPi
113106
uses: pypa/gh-action-pypi-publish@release/v1
114107
# Only publish on pushes to main

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ venv*
1616
.venv
1717
.act*
1818

19-
buildrunner/version.py
20-
2119
buildrunner.results
2220
curator.results
2321

.hgignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,5 @@ dist
1111

1212
.eggs
1313

14-
buildrunner/version.py
15-
1614
buildrunner.results
1715
curator.results

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
33
# Ruff version.
4-
rev: v0.1.7
4+
rev: v0.12.7
55
hooks:
66
# Run the linter.
7-
- id: ruff
7+
- id: ruff-check
88
args: [ --fix ]
99
# Run the formatter.
1010
- id: ruff-format

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.11.4
1+
3.11

BASE_VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
3.0
99
###
1010

11+
* 3.17
12+
13+
* Add python 3.13 support
14+
* Migrate to uv for dependency management
15+
16+
* ... undocumented versions, see GitHub tagged releases ...
17+
1118
* 3.0
1219

1320
* Add python 3.11 support

Dockerfile

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
FROM python:3.11-bookworm
22

33
ENV BUILDRUNNER_CONTAINER 1
4-
ENV PIP_DEFAULT_TIMEOUT 60
54

65
# Install the docker client for multiplatform builds
76
RUN apt update && \
@@ -31,26 +30,18 @@ RUN \
3130
python3-dev && \
3231
apt clean all
3332

34-
# Install requirements first and then buildrunner itself for better docker image layer caching
35-
# HACK - For some reason, 'python3 setup.py install' produces an error with 'jaraco-classes' package
36-
# but replacing it with 'jaraco.classes' in the requirements.txt works. ¯\_(ツ)_/¯
37-
COPY *requirements.txt /tmp/setup/
38-
RUN \
39-
cd /tmp/setup && \
40-
python3 -m pip install -U pip && \
41-
sed -i s/jaraco-classes/jaraco.classes/ requirements.txt && \
42-
python3 -m pip install \
43-
-r requirements.txt && \
44-
python3 -m pip install \
45-
-r test_requirements.txt && \
46-
rm -rf /tmp/setup
47-
COPY . /buildrunner-source
48-
RUN \
49-
cd /buildrunner-source && \
50-
sed -i s/jaraco-classes/jaraco.classes/ requirements.txt && \
51-
python3 scripts/write-version.py && \
52-
pip install . && \
53-
rm -rf /buildrunner-source
33+
WORKDIR /app
34+
35+
# Install uv
36+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/
37+
38+
# Install dependencies first to leverage Docker cache
39+
COPY pyproject.toml uv.lock README.rst /app/
40+
RUN uv sync --locked --no-install-project --no-dev
41+
42+
# Install the project separately for optimal layer caching
43+
COPY buildrunner /app/buildrunner
44+
RUN uv sync --locked --no-dev
5445

5546
# The following will install docker-engine. It's not needed for the container to run,
5647
# but was very helpful during development
@@ -63,5 +54,5 @@ RUN \
6354
# apt-get update; \
6455
# apt-get -y install docker-engine
6556

66-
ENTRYPOINT ["/usr/local/bin/buildrunner"]
57+
ENTRYPOINT ["uv", "run", "buildrunner"]
6758
CMD []

MANIFEST.in

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

README.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ See `docs/installation <docs/installation.rst>`_.
3737
Development
3838
============
3939

40-
See `docs/development <docs/development.rst>`_.
40+
See `docs/development <docs/development.rst>`__.
4141

4242
Global Configuration
4343
====================
@@ -1202,7 +1202,8 @@ The test suite is located in the `tests subdirectory <tests>`_. These tests are
12021202
on every PR build and every build.
12031203

12041204
The test suite can be invoked manually from the top of the source directory by using
1205-
``pytest`` after installing all of the requirements and test requirements with ``pip``.
1205+
``uv run pytest`` after installing dependencies with ``uv sync``. See
1206+
`docs/development <docs/development.rst>`__ for more information.
12061207

12071208

12081209
.. Links

0 commit comments

Comments
 (0)