Skip to content

Commit fea9391

Browse files
authored
build: split prod and dev lock files for pdm (#783)
1 parent e476dfe commit fea9391

File tree

18 files changed

+1271
-964
lines changed

18 files changed

+1271
-964
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ jobs:
2525
cache: true
2626
python-version: ${{ matrix.python-version }}
2727
version: 2.20.1
28+
cache-dependency-path: |
29+
./pdm.dev.lock
30+
./pdm.lock
2831
- run: env | sort
2932
- run: make prerequisites
3033
- run: make dev

.github/workflows/readthedocs-preview.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ on:
2020
- Makefile
2121
- README.md
2222
- docs/**
23+
- pdm.dev.lock
2324
- pdm.lock
2425
permissions:
2526
pull-requests: write

.github/workflows/release.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ jobs:
2323
cache: true
2424
python-version: '3.12'
2525
version: 2.20.1
26+
cache-dependency-path: |
27+
./pdm.dev.lock
28+
./pdm.lock
2629
- run: env | sort
2730
- run: make dev-doc
2831
- run: make doc
@@ -124,6 +127,9 @@ jobs:
124127
cache: true
125128
python-version: '3.12'
126129
version: 2.20.1
130+
cache-dependency-path: |
131+
./pdm.dev.lock
132+
./pdm.lock
127133
- run: env | sort
128134
- env:
129135
PDM_PUBLISH_PASSWORD: ${{ secrets.PDM_PUBLISH_PASSWORD }}

.gitlab/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ci:
99
- .venv
1010
key:
1111
files:
12+
- pdm.dev.lock
1213
- pdm.lock
1314
prefix: venv-${PYTHON_VERSION}
1415
coverage: /TOTAL.*? (100(?:\.0+)?\%\|[1-9]?\d(?:\.\d+)?\%)$/

.gitlab/workflows/release.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pages-build:
77
- .venv
88
key:
99
files:
10+
- pdm.dev.lock
1011
- pdm.lock
1112
prefix: venv-${PYTHON_VERSION}
1213
policy: pull
@@ -97,6 +98,15 @@ container-publish:
9798
PYTHON_VERSION: ${PYTHON_VERSION}
9899
SOURCE_DATE_EPOCH: 0
99100
package-publish:
101+
cache:
102+
paths:
103+
- .venv
104+
key:
105+
files:
106+
- pdm.dev.lock
107+
- pdm.lock
108+
prefix: venv-${PYTHON_VERSION}
109+
policy: pull
100110
rules:
101111
- if: $CI_COMMIT_TAG =~ /^v?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-?(a|b|rc)(0|[1-9][0-9]*)?)?$/
102112
script:

.pre-commit-config.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,17 @@ repos:
3636
hooks:
3737
- id: pdm-sync
3838
name: pdm-sync
39-
entry: pdm sync --clean
39+
entry: pdm sync
40+
language: python
41+
stages:
42+
- post-checkout
43+
- post-merge
44+
- post-rewrite
45+
always_run: true
46+
pass_filenames: false
47+
- id: pdm-dev-sync
48+
name: pdm-dev-sync
49+
entry: pdm sync --lockfile pdm.dev.lock
4050
language: python
4151
stages:
4252
- post-checkout
@@ -50,6 +60,12 @@ repos:
5060
language: python
5161
files: ^pyproject.toml$
5262
pass_filenames: false
63+
- id: pdm-dev-lock-check
64+
name: pdm-lock-check
65+
entry: pdm lock --check --lockfile pdm.dev.lock
66+
language: python
67+
files: ^pyproject.toml$
68+
pass_filenames: false
5369
- id: mypy
5470
name: mypy
5571
entry: pdm run python -m mypy

.readthedocs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ build:
1515
Makefile \
1616
README.md \
1717
docs/ \
18+
pdm.dev.lock \
1819
pdm.lock;
1920
then
2021
exit 183;

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ install:
4545
pdm sync --prod
4646

4747
# Install the package in editable mode with specific optional dependencies.
48-
dev-%:
49-
pdm sync --dev --group $*
48+
dev-%: install
49+
pdm sync --lockfile pdm.dev.lock --no-default --dev --group $*
5050

5151
# Prepare the development environment.
5252
# Install the package in editable mode with all optional dependencies and pre-commit hook.
53-
dev:
54-
pdm sync
53+
dev: install
54+
pdm sync --lockfile pdm.dev.lock
5555
if [ "$(CI)" != "true" ] && command -v pre-commit > /dev/null 2>&1; then pre-commit install; fi
5656

5757
# Install standalone tools
@@ -157,7 +157,7 @@ template-watch:
157157
watchfiles "make template-build" template includes copier.yaml
158158

159159
template-build:
160-
find . -maxdepth 1 | grep -vE '(\.|\.git|template|includes|copier\.yaml|pdm\.lock)$$' | xargs -I {} rm -r {}
160+
find . -maxdepth 1 | grep -vE '(\.|\.git|template|includes|copier\.yaml|pdm\.lock|pdm\.dev\.lock)$$' | xargs -I {} rm -r {}
161161
copier copy -r HEAD --data-file includes/copier-answers-sample.yml --data repo_platform=gitlab -f . .
162162
rm -rf .copier-answers.yml
163163
copier copy -r HEAD --data-file includes/copier-answers-sample.yml -f . .

pdm.dev.lock

Lines changed: 1170 additions & 0 deletions
Large diffs are not rendered by default.

pdm.lock

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

0 commit comments

Comments
 (0)