Skip to content

Commit ae3bbe5

Browse files
authored
Merge pull request #64 from ecmwf-projects/template-update
template update
2 parents 6f09912 + 8bb36af commit ae3bbe5

File tree

5 files changed

+86
-46
lines changed

5 files changed

+86
-46
lines changed

.cruft.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"template": "https://github.com/ecmwf-projects/cookiecutter-conda-package",
3-
"commit": "22b85d3aca63d05f4a19f1a531bcea311617f4cd",
3+
"commit": "ce9afbb8510935c0206746d26f05f6b80e9d0087",
44
"checkout": null,
55
"context": {
66
"cookiecutter": {

.github/workflows/on-push.yml

+73-35
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,18 @@ jobs:
3333

3434
steps:
3535
- uses: actions/checkout@v4
36+
- uses: actions/setup-python@v4
37+
with:
38+
python-version: 3.x
3639
- name: Install conda-merge
3740
run: |
38-
$CONDA/bin/python -m pip install conda-merge
41+
python -m pip install conda-merge
3942
- name: Combine environments
4043
run: |
4144
for SUFFIX in ci integration; do
42-
$CONDA/bin/conda-merge ci/environment-$SUFFIX.yml environment.yml > ci/combined-environment-$SUFFIX.yml || exit
45+
conda-merge ci/environment-$SUFFIX.yml environment.yml > ci/combined-environment-$SUFFIX.yml || exit
4346
done
44-
- name: Archive combined environments
45-
uses: actions/upload-artifact@v3
47+
- uses: actions/upload-artifact@v3
4648
with:
4749
name: combined-environments
4850
path: ci/combined-environment-*.yml
@@ -57,17 +59,20 @@ jobs:
5759

5860
steps:
5961
- uses: actions/checkout@v4
60-
- name: Download combined environments
61-
uses: actions/download-artifact@v3
62+
- uses: actions/download-artifact@v3
6263
with:
6364
name: combined-environments
6465
path: ci
65-
- name: Install Conda environment with Micromamba
66-
uses: mamba-org/setup-micromamba@v1
66+
- name: Get current date
67+
id: date
68+
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
69+
- uses: mamba-org/setup-micromamba@v1
6770
with:
6871
environment-file: ci/combined-environment-ci.yml
6972
environment-name: DEVELOP
7073
cache-environment: true
74+
cache-environment-key: environment-${{ steps.date.outputs.date }}
75+
cache-downloads-key: downloads-${{ steps.date.outputs.date }}
7176
create-args: >-
7277
python=${{ matrix.python-version }}
7378
- name: Install package
@@ -83,17 +88,20 @@ jobs:
8388

8489
steps:
8590
- uses: actions/checkout@v4
86-
- name: Download combined environments
87-
uses: actions/download-artifact@v3
91+
- uses: actions/download-artifact@v3
8892
with:
8993
name: combined-environments
9094
path: ci
91-
- name: Install Conda environment with Micromamba
92-
uses: mamba-org/setup-micromamba@v1
95+
- name: Get current date
96+
id: date
97+
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
98+
- uses: mamba-org/setup-micromamba@v1
9399
with:
94100
environment-file: ci/combined-environment-ci.yml
95101
environment-name: DEVELOP
96102
cache-environment: true
103+
cache-environment-key: environment-${{ steps.date.outputs.date }}
104+
cache-downloads-key: downloads-${{ steps.date.outputs.date }}
97105
create-args: >-
98106
python=3.10
99107
- name: Install package
@@ -109,17 +117,20 @@ jobs:
109117

110118
steps:
111119
- uses: actions/checkout@v4
112-
- name: Download combined environments
113-
uses: actions/download-artifact@v3
120+
- uses: actions/download-artifact@v3
114121
with:
115122
name: combined-environments
116123
path: ci
117-
- name: Install Conda environment with Micromamba
118-
uses: mamba-org/setup-micromamba@v1
124+
- name: Get current date
125+
id: date
126+
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
127+
- uses: mamba-org/setup-micromamba@v1
119128
with:
120129
environment-file: ci/combined-environment-ci.yml
121130
environment-name: DEVELOP
122131
cache-environment: true
132+
cache-environment-key: environment-${{ steps.date.outputs.date }}
133+
cache-downloads-key: downloads-${{ steps.date.outputs.date }}
123134
create-args: >-
124135
python=3.10
125136
- name: Install package
@@ -145,17 +156,20 @@ jobs:
145156

146157
steps:
147158
- uses: actions/checkout@v4
148-
- name: Download combined environments
149-
uses: actions/download-artifact@v3
159+
- uses: actions/download-artifact@v3
150160
with:
151161
name: combined-environments
152162
path: ci
153-
- name: Install Conda environment with Micromamba
154-
uses: mamba-org/setup-micromamba@v1
163+
- name: Get current date
164+
id: date
165+
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
166+
- uses: mamba-org/setup-micromamba@v1
155167
with:
156168
environment-file: ci/combined-environment${{ matrix.extra }}.yml
157169
environment-name: DEVELOP${{ matrix.extra }}
158170
cache-environment: true
171+
cache-environment-key: environment-${{ steps.date.outputs.date }}
172+
cache-downloads-key: downloads-${{ steps.date.outputs.date }}
159173
create-args: >-
160174
python=${{ matrix.python-version }}
161175
- name: Install package
@@ -168,11 +182,6 @@ jobs:
168182
distribution:
169183
runs-on: ubuntu-latest
170184
needs: [unit-tests, type-check, docs-build, integration-tests]
171-
environment:
172-
name: pypi
173-
url: https://pypi.org/p/ogc-api-processes-fastapi
174-
permissions:
175-
id-token: write # IMPORTANT: this permission is mandatory for trusted publish
176185
if: |
177186
always() &&
178187
needs.unit-tests.result == 'success' &&
@@ -182,18 +191,47 @@ jobs:
182191
183192
steps:
184193
- uses: actions/checkout@v4
185-
- name: Install packages
194+
- uses: actions/setup-python@v4
195+
with:
196+
python-version: '3.10'
197+
- name: Install package
186198
run: |
187-
$CONDA/bin/python -m pip install build twine
188-
- name: Build distributions
199+
python -m pip install --upgrade pip
200+
python -m pip install build twine
201+
- name: Build distribution
189202
run: |
190-
$CONDA/bin/python -m build
203+
python -m build
191204
- name: Check wheels
192205
run: |
193206
cd dist || exit
194-
$CONDA/bin/python -m pip install ogc_api_processes_fastapi*.whl || exit
195-
$CONDA/bin/python -m twine check * || exit
196-
$CONDA/bin/python -c "import ogc_api_processes_fastapi"
197-
- name: Publish a Python distribution to PyPI
198-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
199-
uses: pypa/gh-action-pypi-publish@release/v1
207+
python -m pip install ogc_api_processes_fastapi*.whl || exit
208+
python -m twine check --strict * || exit
209+
python -c "import ogc_api_processes_fastapi" || exit
210+
cd ..
211+
- uses: actions/upload-artifact@v3
212+
with:
213+
name: distribution
214+
path: dist
215+
216+
upload-to-pypi:
217+
runs-on: ubuntu-latest
218+
needs: distribution
219+
if: |
220+
always() &&
221+
needs.distribution.result == 'success' &&
222+
github.event_name == 'push' &&
223+
startsWith(github.ref, 'refs/tags')
224+
environment:
225+
name: pypi
226+
url: https://pypi.org/p/ogc-api-processes-fastapi
227+
permissions:
228+
id-token: write # IMPORTANT: this permission is mandatory for trusted publish
229+
230+
steps:
231+
- uses: actions/download-artifact@v3
232+
with:
233+
name: distribution
234+
path: dist
235+
- uses: pypa/[email protected]
236+
with:
237+
verbose: true

.pre-commit-config.yaml

+5-7
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,20 @@ repos:
88
- id: check-yaml
99
- id: check-toml
1010
- id: check-added-large-files
11+
- id: check-merge-conflict
1112
- id: debug-statements
1213
- id: mixed-line-ending
13-
- repo: https://github.com/psf/black
14-
rev: 23.9.1
15-
hooks:
16-
- id: black
1714
- repo: https://github.com/keewis/blackdoc
18-
rev: v0.3.8
15+
rev: v0.3.9
1916
hooks:
2017
- id: blackdoc
21-
additional_dependencies: [black==22.3.0]
18+
additional_dependencies: [black==23.11.0]
2219
- repo: https://github.com/astral-sh/ruff-pre-commit
23-
rev: v0.0.292
20+
rev: v0.1.5
2421
hooks:
2522
- id: ruff
2623
args: [--fix, --show-fixes]
24+
- id: ruff-format
2725
- repo: https://github.com/executablebooks/mdformat
2826
rev: 0.7.17
2927
hooks:

ogc_api_processes_fastapi/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def register_route(
3939
response_model_exclude_unset=True,
4040
response_model_exclude_none=True,
4141
endpoint=route_endpoint,
42-
**config.ROUTES[route_name].model_dump(exclude={"client_method"})
42+
**config.ROUTES[route_name].model_dump(exclude={"client_method"}),
4343
)
4444

4545

pyproject.toml

+6-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ ignore = [
3636
# pydocstyle: Missing Docstrings
3737
"D1"
3838
]
39-
# Black line length is 88, but black does not format comments.
40-
line-length = 110
39+
# Same as Black.
40+
indent-width = 4
41+
line-length = 88
4142
select = [
4243
# pyflakes
4344
"F",
@@ -50,6 +51,9 @@ select = [
5051
"D"
5152
]
5253

54+
[tool.ruff.lint.pycodestyle]
55+
max-line-length = 110
56+
5357
[tool.ruff.pydocstyle]
5458
convention = "numpy"
5559

0 commit comments

Comments
 (0)