Skip to content

Commit 2e04c4c

Browse files
authored
Merge pull request #2132 from hgrecco/develop
Upgrade infrastructure to pixi/uv/ruff, bump minimum python version to 3.11 Develop
2 parents 811c5ed + 80b390f commit 2e04c4c

29 files changed

+755
-834
lines changed

.github/workflows/ci.yml

+61-171
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,45 @@
1-
name: CI
1+
name: Test and release when tagged
22

3-
on: [push, pull_request]
3+
on: [push]
44

55
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- uses: prefix-dev/[email protected]
11+
with:
12+
environments: lint
13+
- run: pixi run --environment lint lint
14+
615
test-linux:
16+
runs-on: ubuntu-latest
717
strategy:
8-
fail-fast: false
918
matrix:
10-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
19+
environment:
20+
- test-py311
21+
- test-py312
22+
- test-py313
1123
numpy: [null, "numpy>=1.23,<2.0.0", "numpy>=2.0.0rc1"]
1224
uncertainties: [null, "uncertainties==3.1.6", "uncertainties>=3.1.6,<4.0.0"]
1325
extras: [null]
1426
include:
15-
- python-version: "3.10" # Minimal versions
27+
- environment: "test-py311" # Minimal versions
1628
numpy: "numpy>=1.23,<2.0.0"
1729
extras: matplotlib==3.5.3
18-
- python-version: "3.10"
30+
- environment: "test-py311"
1931
numpy: "numpy"
2032
uncertainties: "uncertainties"
2133
extras: "sparse xarray netCDF4 dask[complete]==2024.5.1 graphviz babel==2.8 mip>=1.13"
22-
- python-version: "3.10"
34+
- environment: "test-py311"
2335
numpy: "numpy==1.26.1"
2436
uncertainties: null
2537
extras: "babel==2.15 matplotlib==3.9.0"
26-
runs-on: ubuntu-latest
27-
28-
env:
29-
TEST_OPTS: "-rfsxEX -s --cov=pint --cov-config=.coveragerc --benchmark-skip"
30-
3138
steps:
32-
- uses: actions/checkout@v2
39+
- uses: actions/checkout@v4
40+
- uses: prefix-dev/[email protected]
3341
with:
34-
fetch-depth: 100
35-
36-
- name: Get tags
37-
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
38-
39-
- name: Set up Python ${{ matrix.python-version }}
40-
uses: actions/setup-python@v2
41-
with:
42-
python-version: ${{ matrix.python-version }}
43-
44-
- name: Get pip cache dir
45-
id: pip-cache
46-
run: echo "::set-output name=dir::$(pip cache dir)"
47-
48-
- name: Setup caching
49-
uses: actions/cache@v2
50-
with:
51-
path: ${{ steps.pip-cache.outputs.dir }}
52-
key: pip-${{ matrix.python-version }}
53-
restore-keys: |
54-
pip-${{ matrix.python-version }}
55-
42+
environments: ${{ matrix.environment }}
5643
- name: Install numpy
5744
if: ${{ matrix.numpy != null }}
5845
run: pip install "${{matrix.numpy}}"
@@ -77,164 +64,67 @@ jobs:
7764
run: |
7865
sudo apt install -y graphviz
7966
pip install packaging
80-
pip install .[testbase]
8167
8268
- name: Install pytest-mpl
8369
if: contains(matrix.extras, 'matplotlib')
8470
run: pip install pytest-mpl
85-
86-
- name: Run Tests
87-
run: |
88-
pytest $TEST_OPTS
89-
90-
# - name: Coverage report
91-
# run: coverage report -m
92-
93-
# - name: Coveralls Parallel
94-
# env:
95-
# COVERALLS_FLAG_NAME: ${{ matrix.test-number }}
96-
# COVERALLS_PARALLEL: true
97-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98-
# COVERALLS_SERVICE_NAME: github
99-
# run: |
100-
# pip install coveralls "requests<2.29"
101-
# coveralls
71+
- run: pixi run --environment ${{ matrix.environment }} test
10272

10373
test-windows:
74+
runs-on: windows-latest
10475
strategy:
105-
fail-fast: false
10676
matrix:
107-
python-version: ["3.10", "3.11", "3.12"]
108-
numpy: [ "numpy>=1.23,<2.0.0" ]
109-
runs-on: windows-latest
110-
111-
env:
112-
TEST_OPTS: "-rfsxEX -s -k issue1498b --benchmark-skip"
113-
77+
environment:
78+
- test-py311
79+
- test-py312
80+
- test-py313
81+
numpy: [null, "numpy>=1.23,<2.0.0", "numpy>=2.0.0rc1"]
11482
steps:
115-
- uses: actions/checkout@v2
116-
with:
117-
fetch-depth: 100
118-
119-
- name: Get tags
120-
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
121-
122-
- name: Set up Python ${{ matrix.python-version }}
123-
uses: actions/setup-python@v2
124-
with:
125-
python-version: ${{ matrix.python-version }}
126-
127-
- name: Get pip cache dir
128-
id: pip-cache
129-
run: echo "::set-output name=dir::$(pip cache dir)"
130-
131-
- name: Setup caching
132-
uses: actions/cache@v2
83+
- uses: actions/checkout@v4
84+
- uses: prefix-dev/[email protected]
13385
with:
134-
path: ${{ steps.pip-cache.outputs.dir }}
135-
key: pip-windows-${{ matrix.python-version }}
136-
restore-keys: |
137-
pip-windows-${{ matrix.python-version }}
138-
86+
environments: ${{ matrix.environment }}
13987
- name: Install numpy
14088
if: ${{ matrix.numpy != null }}
14189
run: pip install "${{matrix.numpy}}"
142-
143-
# - name: Install uncertainties
144-
# if: ${{ matrix.uncertainties != null }}
145-
# run: pip install "${{matrix.uncertainties}}"
146-
#
147-
# - name: Install extras
148-
# if: ${{ matrix.extras != null }}
149-
# run: pip install ${{matrix.extras}}
150-
151-
- name: Install dependencies
152-
run: |
153-
# sudo apt install -y graphviz
154-
pip install packaging
155-
pip install .[testbase]
156-
157-
# - name: Install pytest-mpl
158-
# if: contains(matrix.extras, 'matplotlib')
159-
# run: pip install pytest-mpl
160-
161-
- name: Run tests
162-
run: pytest -rfsxEX -s -k issue1498b --benchmark-skip
90+
- run: pixi run --environment ${{ matrix.environment }} test
16391

16492
test-macos:
93+
runs-on: macos-latest
16594
strategy:
166-
fail-fast: false
16795
matrix:
168-
python-version: ["3.10", "3.11", "3.12"]
169-
numpy: [null, "numpy>=1.23,<2.0.0" ]
170-
runs-on: macos-latest
171-
172-
env:
173-
TEST_OPTS: "-rfsxEX -s --cov=pint --cov-config=.coveragerc --benchmark-skip"
174-
96+
environment:
97+
- test-py311
98+
- test-py312
99+
- test-py313
100+
numpy: [null, "numpy>=1.23,<2.0.0", "numpy>=2.0.0rc1"]
175101
steps:
176-
- uses: actions/checkout@v2
102+
- uses: actions/checkout@v4
103+
- uses: prefix-dev/[email protected]
177104
with:
178-
fetch-depth: 100
179-
180-
- name: Get tags
181-
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
182-
183-
- name: Set up Python ${{ matrix.python-version }}
184-
uses: actions/setup-python@v2
185-
with:
186-
python-version: ${{ matrix.python-version }}
187-
188-
- name: Get pip cache dir
189-
id: pip-cache
190-
run: echo "::set-output name=dir::$(pip cache dir)"
191-
192-
- name: Setup caching
193-
uses: actions/cache@v2
194-
with:
195-
path: ${{ steps.pip-cache.outputs.dir }}
196-
key: pip-${{ matrix.python-version }}
197-
restore-keys: |
198-
pip-${{ matrix.python-version }}
199-
105+
environments: ${{ matrix.environment }}
200106
- name: Install numpy
201107
if: ${{ matrix.numpy != null }}
202108
run: pip install "${{matrix.numpy}}"
109+
- run: pixi run --environment ${{ matrix.environment }} test
203110

204-
- name: Install dependencies
205-
run: |
206-
pip install packaging
207-
pip install .[testbase]
208-
209-
- name: Run Tests
210-
run: |
211-
pytest $TEST_OPTS
212-
213-
# - name: Coverage report
214-
# run: coverage report -m
111+
publish:
112+
if: github.ref_type == 'tag'
113+
needs: [test-linux, test-windows, test-macos, lint]
215114

216-
# - name: Coveralls Parallel
217-
# env:
218-
# COVERALLS_FLAG_NAME: ${{ matrix.test-number }}
219-
# COVERALLS_PARALLEL: true
220-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
221-
# COVERALLS_SERVICE_NAME: github
222-
# run: |
223-
# pip install coveralls "requests<2.29"
224-
# coveralls
115+
runs-on: ubuntu-latest
116+
environment:
117+
name: pypi
118+
url: https://pypi.org/p/pint
119+
permissions:
120+
id-token: write # for trusted publising to PyPI
225121

226-
# coveralls:
227-
# needs: test-linux
228-
# runs-on: ubuntu-latest
229-
# steps:
230-
# - uses: actions/setup-python@v2
231-
# with:
232-
# python-version: 3.x
233-
# - name: Coveralls Finished
234-
# continue-on-error: true
235-
# env:
236-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
237-
# COVERALLS_SERVICE_NAME: github
238-
# run: |
239-
# pip install coveralls "requests<2.29"
240-
# coveralls --finish
122+
steps:
123+
- uses: actions/checkout@v4
124+
- uses: prefix-dev/[email protected]
125+
with:
126+
environments: build
127+
- name: Build the package
128+
run: pixi run --environment build build
129+
- name: Publish to PyPI
130+
run: pixi run --environment build publish

.github/workflows/docs.yml

+11-36
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,21 @@ on: [push, pull_request]
55
jobs:
66
docbuild:
77
runs-on: ubuntu-latest
8-
98
steps:
10-
- uses: actions/checkout@v2
11-
with:
12-
fetch-depth: 100
13-
14-
- name: Get tags
15-
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
16-
17-
- name: Set up minimal Python version
18-
uses: actions/setup-python@v2
9+
- uses: actions/checkout@v4
10+
- uses: prefix-dev/[email protected]
1911
with:
20-
python-version: "3.10"
21-
22-
- name: Get pip cache dir
23-
id: pip-cache
24-
run: echo "::set-output name=dir::$(pip cache dir)"
25-
26-
- name: Setup pip cache
27-
uses: actions/cache@v2
12+
environments: docs
13+
- run: pixi run --environment docs docbuild
14+
doctest:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: prefix-dev/[email protected]
2819
with:
29-
path: ${{ steps.pip-cache.outputs.dir }}
30-
key: pip-docs
31-
restore-keys: pip-docs
32-
20+
environments: docs
3321
- name: Install locales
3422
run: |
3523
sudo apt-get install language-pack-fr
3624
sudo localedef -i fr_FR -f UTF-8 fr_FR
37-
38-
- name: Install dependencies
39-
run: |
40-
sudo apt install -y pandoc
41-
pip install --upgrade pip setuptools wheel
42-
pip install -r "requirements_docs.txt"
43-
pip install docutils==0.14 commonmark==0.8.1 recommonmark==0.5.0 babel==2.8
44-
pip install .
45-
46-
- name: Build documentation
47-
run: sphinx-build -n -j auto -b html -d build/doctrees docs build/html
48-
49-
- name: Doc Tests
50-
run: sphinx-build -a -j auto -b doctest -d build/doctrees docs build/doctest
25+
- run: pixi run --environment docs doctest

.github/workflows/lint-autoupdate.yml

-46
This file was deleted.

0 commit comments

Comments
 (0)