Skip to content

Commit 129009e

Browse files
authored
Merge pull request #33 from znicholls/update-copier
Update copier and add other authors
2 parents 672f89a + fcac86f commit 129009e

16 files changed

Lines changed: 297 additions & 293 deletions

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2-
_commit: v0.12.3
2+
_commit: v0.14.3
33
_src_path: gl:openscm/copier-core-python-repository
44
conda_release: false
55
email: zebedee.nicholls@climate-energy-college.org

.github/actions/setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ runs:
2020
id: setup-uv
2121
uses: astral-sh/setup-uv@v4
2222
with:
23-
version: "0.5.21"
23+
version: "0.8.8"
2424
python-version: ${{ inputs.python-version }}
2525
- name: Install dependencies
2626
shell: bash

.github/workflows/bump.yaml

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
11
name: Bump version
2-
# For the time being, we still do this with pdm.
3-
# Honestly, it doesn't really matter,
4-
# but one day uv will have a bump command too and we can switch to that.
5-
# Relevant issue in uv: https://github.com/astral-sh/uv/issues/6298
62

73
on:
84
workflow_dispatch:
95
inputs:
106
bump_rule:
117
type: choice
12-
description: How to bump the project's version (see https://github.com/carstencodes/pdm-bump#usage)
8+
description: How to bump the project's version (see https://docs.astral.sh/uv/reference/cli/#uv-version)
139
options:
14-
- no-pre-release
15-
# no micro because we always sit on a pre-release in main,
16-
# so we would always use no-pre-release instead of micro
17-
# - micro
10+
- patch
1811
- minor
1912
- major
20-
- "pre-release --pre alpha"
21-
- "pre-release --pre beta"
22-
- "pre-release --pre release-candidate"
13+
- stable
14+
- alpha
15+
- beta
16+
- rc
17+
- post
18+
- dev
2319
required: true
2420

2521
jobs:
@@ -29,7 +25,7 @@ jobs:
2925
strategy:
3026
matrix:
3127
os: [ "ubuntu-latest" ]
32-
python-version: [ "3.9" ]
28+
python-version: [ "3.11" ]
3329
runs-on: "${{ matrix.os }}"
3430
env:
3531
CI_COMMIT_EMAIL: "ci-runner@cmip-branded-variable-mapper.invalid"
@@ -40,15 +36,6 @@ jobs:
4036
fetch-depth: 0
4137
token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}"
4238

43-
- name: Setup PDM
44-
uses: pdm-project/setup-pdm@v4.1
45-
with:
46-
python-version: ${{ matrix.python-version }}
47-
48-
- name: Install pdm-bump
49-
run: |
50-
pdm self add pdm-bump
51-
5239
- uses: ./.github/actions/setup
5340
with:
5441
python-version: ${{ matrix.python-version }}
@@ -59,13 +46,13 @@ jobs:
5946
git config --global user.name "$GITHUB_ACTOR"
6047
git config --global user.email "$CI_COMMIT_EMAIL"
6148
62-
BASE_VERSION=`sed -ne 's/^version = "\([0-9\.a]*\)"/\1/p' pyproject.toml`
49+
BASE_VERSION=`sed -ne 's/^version = "\([0-9\.post]*\)"/\1/p' pyproject.toml`
6350
echo "Bumping from version $BASE_VERSION"
6451
6552
# Bump
66-
pdm bump ${{ github.event.inputs.bump_rule }}
53+
uv version --bump ${{ github.event.inputs.bump_rule }}
6754
68-
NEW_VERSION=`sed -ne 's/^version = "\([0-9\.a]*\)"/\1/p' pyproject.toml`
55+
NEW_VERSION=`sed -ne 's/^version = "\([0-9\.]*\)"/\1/p' pyproject.toml`
6956
echo "Bumping to version $NEW_VERSION"
7057
7158
# Build CHANGELOG
@@ -78,12 +65,12 @@ jobs:
7865
7966
# Bump to alpha (so that future commits do not have the same
8067
# version as the tagged commit)
81-
BASE_VERSION=`sed -ne 's/^version = "\([0-9\.a]*\)"/\1/p' pyproject.toml`
68+
BASE_VERSION=`sed -ne 's/^version = "\([0-9\.]*\)"/\1/p' pyproject.toml`
8269
8370
# Bump to pre-release of next version
84-
pdm bump pre-release --pre alpha
71+
uv version --bump post
8572
86-
NEW_VERSION=`sed -ne 's/^version = "\([0-9\.a]*\)"/\1/p' pyproject.toml`
73+
NEW_VERSION=`sed -ne 's/^version = "\([0-9\.post]*\)"/\1/p' pyproject.toml`
8774
echo "Bumping version $BASE_VERSION > $NEW_VERSION"
8875
8976
# Commit and push

.github/workflows/ci.yaml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ jobs:
137137
id: setup-uv
138138
uses: astral-sh/setup-uv@v4
139139
with:
140-
version: "0.5.21"
140+
version: "0.8.8"
141141
python-version: ${{ matrix.python-version }}
142142
- name: Create venv
143143
run: |
@@ -181,7 +181,8 @@ jobs:
181181
- name: Install
182182
run: |
183183
pip install --upgrade pip wheel
184-
pip install .
184+
pip install --no-deps .
185+
pip install -r requirements-locked.txt
185186
pip install -r requirements-only-tests-min-locked.txt
186187
- name: Run tests
187188
run: |
@@ -223,21 +224,15 @@ jobs:
223224
id: setup-uv
224225
uses: astral-sh/setup-uv@v4
225226
with:
226-
version: "0.5.21"
227-
python-version: ${{ matrix.python-version }}
228-
- name: Setup PDM
229-
uses: pdm-project/setup-pdm@v4.1
230-
with:
227+
version: "0.8.8"
231228
python-version: ${{ matrix.python-version }}
232-
- name: Generate pdm.lock
233-
# Required for building the locked version of the package
234-
# with pdm-build-locked (see pyproject.toml)
235-
run: |
236-
pdm lock --group :all --strategy inherit_metadata --python="<3.13"
237-
pdm lock --group :all --python=">=3.13" --append
238229
- name: Build package
239230
run: |
231+
uv run python scripts/add-locked-targets-to-pyproject-toml.py
232+
cat pyproject.toml
240233
uv build
234+
# Just in case, undo the changes to `pyproject.toml`
235+
git restore --staged . && git restore .
241236
- name: Check build
242237
run: |
243238
tar -tvf dist/cmip_branded_variable_mapper-*.tar.gz --wildcards '*cmip_branded_variable_mapper/py.typed'

.github/workflows/deploy.yaml

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,12 @@ jobs:
3232
id: setup-uv
3333
uses: astral-sh/setup-uv@v4
3434
with:
35-
version: "0.5.21"
35+
version: "0.8.8"
3636
python-version: ${{ matrix.python-version }}
37-
- name: Setup PDM
38-
uses: pdm-project/setup-pdm@v4.1
39-
with:
40-
python-version: ${{ matrix.python-version }}
41-
- name: Generate pdm.lock
42-
# Required for building the locked version of the package
43-
# with pdm-build-locked (see pyproject.toml)
44-
run: |
45-
pdm lock --group :all --strategy inherit_metadata --python="<3.13"
46-
pdm lock --group :all --python=">=3.13" --append
4737
- name: Publish to PyPI
4838
run: |
39+
uv run python scripts/add-locked-targets-to-pyproject-toml.py
4940
uv build
5041
uv publish
42+
# Just in case, undo the changes to `pyproject.toml`
43+
git restore --staged . && git restore .

.github/workflows/release.yaml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
os: [ "ubuntu-latest" ]
17-
python-version: [ "3.9" ]
17+
python-version: [ "3.11" ]
1818
runs-on: "${{ matrix.os }}"
1919
steps:
2020
- name: Check out repository
@@ -25,25 +25,18 @@ jobs:
2525
id: setup-uv
2626
uses: astral-sh/setup-uv@v4
2727
with:
28-
version: "0.5.21"
28+
version: "0.8.8"
2929
python-version: ${{ matrix.python-version }}
30-
- name: Setup PDM
31-
uses: pdm-project/setup-pdm@v4.1
32-
with:
33-
python-version: ${{ matrix.python-version }}
34-
- name: Generate pdm.lock
35-
# Required for building the locked version of the package
36-
# with pdm-build-locked (see pyproject.toml)
37-
run: |
38-
pdm lock --group :all --strategy inherit_metadata --python="<3.13"
39-
pdm lock --group :all --python=">=3.13" --append
4030
- name: Add version to environment
4131
run: |
42-
PROJECT_VERSION=`sed -ne 's/^version = "\([0-9\.a]*\)"/\1/p' pyproject.toml`
32+
PROJECT_VERSION=`sed -ne 's/^version = "\([0-9\.]*\)"/\1/p' pyproject.toml`
4333
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
4434
- name: Build package for PyPI
4535
run: |
36+
uv run python scripts/add-locked-targets-to-pyproject-toml.py
4637
uv build
38+
# Just in case, undo the changes to `pyproject.toml`
39+
git restore --staged . && git restore .
4740
- name: Generate Release Notes
4841
run: |
4942
echo "" >> ".github/release_template.md"

.github/workflows/test-upstream-latest.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
id: setup-uv
3737
uses: astral-sh/setup-uv@v4
3838
with:
39-
version: "0.5.21"
39+
version: "0.8.8"
4040
python-version: ${{ matrix.python-version }}
4141
# Often you need a step like this for e.g. numpy, scipy, pandas
4242
- name: Setup compilation dependencies

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ licence-check: ## Check that licences of the dependencies are suitable
7777
uv run liccheck -r $(TEMP_FILE) -R licence-check.txt
7878
rm -f $(TEMP_FILE)
7979

80-
8180
.PHONY: virtual-environment
8281
virtual-environment: ## update virtual environment, create a new one if it doesn't already exist
8382
uv sync --all-extras --group all-dev

changelog/33.trivial.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added other authors and updated copier version (no more pdm :D)

docs/development.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ should change depending on the updates to the code base.
4848
Releasing is semi-automated via a CI job.
4949
The CI job requires the type of version bump
5050
that will be performed to be manually specified.
51-
See the pdm-bump docs for the
52-
[list of available bump rules](https://github.com/carstencodes/pdm-bump#usage).
51+
See the `uv version` docs (specifically the `--bump` flag) for the
52+
[list of available bump rules](https://docs.astral.sh/uv/reference/cli/#uv-version).
5353

5454
### Standard process
5555

5656
The steps required are the following:
5757

5858
1. Bump the version: manually trigger the "bump" workflow from the main branch
5959
(see here: [bump workflow](https://github.com/znicholls/CMIP-branded-variables-mapper/actions/workflows/bump.yaml)).
60-
A valid "bump_rule" (see [pdm-bump's docs](https://github.com/carstencodes/pdm-bump#usage))
60+
A valid "bump_rule" (see [uv's docs](https://docs.astral.sh/uv/reference/cli/#uv-version))
6161
will need to be specified.
6262
This will then trigger a draft release.
6363

@@ -78,12 +78,10 @@ The steps required are the following:
7878

7979
#### Further details
8080

81-
We use [pdm](https://pdm-project.org/en/latest/) for building our project,
82-
while [uv figures out how it wants to support building](https://github.com/astral-sh/uv/issues/3957).
83-
This gives us the added benefit that we can use
84-
[pdm-build-locked](https://pdm-build-locked.readthedocs.io/en/stable/)
85-
to build locked versions of our package.
86-
It is for these reasons that we create a `pdm.lock` file
81+
We use [uv's build backend](https://docs.astral.sh/uv/concepts/build-backend) for building our project
82+
and `scripts/add-locked-targets-to-pyproject-toml.py`
83+
to provide locked extra groups for our package.
84+
Including locked extra groups is why we run `scripts/add-locked-targets-to-pyproject-toml.py`
8785
before any step related to building the package in the CI.
8886

8987
## Read the Docs

0 commit comments

Comments
 (0)