-
Notifications
You must be signed in to change notification settings - Fork 24
261 lines (249 loc) · 11.7 KB
/
python-package.yml
File metadata and controls
261 lines (249 loc) · 11.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# Workflow is based on the Astropy GitHub actions workflow, ci_workflows.yml
name: CI
on:
push:
branches:
- '*'
tags:
- '*'
pull_request:
jobs:
tests:
name: Unit tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- os: ubuntu-latest
python-version: '3.13'
numpy-version: '<2.3' # Numba does not yet support NumPy 2.3!
scipy-version: ''
astropy-version: '<8.0'
matplotlib-version: ''
fitsio-version: ''
numba-version: ''
- os: ubuntu-latest
python-version: '3.12'
numpy-version: '<2.2'
scipy-version: '<1.16'
astropy-version: '<7.0'
matplotlib-version: '<3.12'
fitsio-version: ''
numba-version: ''
- os: ubuntu-latest
python-version: '3.11'
numpy-version: '<2.1'
scipy-version: '<1.14'
astropy-version: '<6.1'
matplotlib-version: '<3.11'
fitsio-version: ''
numba-version: '<0.70'
- os: ubuntu-latest
python-version: '3.10'
numpy-version: '<2.0'
scipy-version: '<1.14'
astropy-version: '<6.1'
matplotlib-version: '<3.10'
fitsio-version: ''
numba-version: '<0.70'
# os: [ubuntu-latest]
# python-version: ['3.9', '3.10'] # fuji+guadalupe, not ready for 3.11 yet?
# astropy-version: ['==5.0', '<6'] # fuji+guadalupe, latest
# fitsio-version: ['==1.1.6', '<2'] # fuji+guadalupe, latest
# numpy-version: ['<1.23'] # to keep asscalar, used by astropy
# numba-version: ['<0.61.0'] # for compatibility with old numpy
steps:
- name: Install System Packages
run: sudo apt install libbz2-dev subversion
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install pytz healpy llvmlite speclite
python -m pip install 'numpy${{ matrix.numpy-version }}' 'scipy${{ matrix.scipy-version }}' 'astropy${{ matrix.astropy-version }}' 'matplotlib${{ matrix.matplotlib-version }}' specutils
python -m pip cache remove fitsio
python -m pip cache remove numba
python -m pip install --no-deps --force-reinstall --ignore-installed 'fitsio${{ matrix.fitsio-version }}' 'numba${{ matrix.numba-version }}'
python -m pip install pytest
- name: Install DESI dependencies
env:
DESIUTIL_VERSION: 3.6.0 # required for astropy 7.x
SPECTER_VERSION: 0.11.0
GPU_SPECTER_VERSION: main
DESIMODEL_VERSION: 0.19.3
DESITARGET_VERSION: main
REDROCK_VERSION: 0.20.4
run: |
# --no-build-isolation needed for older code tags with latest pip/setuputils
python -m pip install --no-build-isolation desiutil==${DESIUTIL_VERSION}
python -m pip install --no-build-isolation git+https://github.com/desihub/specter.git@${SPECTER_VERSION}
python -m pip install --no-build-isolation git+https://github.com/desihub/gpu_specter.git@${GPU_SPECTER_VERSION}
python -m pip install --no-build-isolation git+https://github.com/desihub/desimodel.git@${DESIMODEL_VERSION}
python -m pip install --no-build-isolation git+https://github.com/desihub/desitarget.git@${DESITARGET_VERSION}
python -m pip install --no-build-isolation git+https://github.com/desihub/redrock.git@${REDROCK_VERSION}
- name: Install desimodel data
env:
DESIMODEL_DATA: branches/test-0.19
run: install_desimodel_data --desimodel-version ${DESIMODEL_DATA}
- name: Run the test
run: pytest
coverage:
name: Test coverage
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
# matches python 3.10 environment above, approximately matching NERSC
os: [ubuntu-latest]
python-version: ['3.10']
numpy-version: ['<2.0']
scipy-version: ['<1.14']
astropy-version: ['<6.1']
matplotlib-version: ['<3.10']
fitsio-version: ['']
numba-version: ['<0.70']
steps:
- name: Install System Packages
run: sudo apt install libbz2-dev subversion
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install pytz healpy llvmlite speclite
python -m pip install 'numpy${{ matrix.numpy-version }}' 'scipy${{ matrix.scipy-version }}' 'astropy${{ matrix.astropy-version }}' 'matplotlib${{ matrix.matplotlib-version }}'
python -m pip cache remove fitsio
python -m pip cache remove numba
python -m pip install --no-deps --force-reinstall --ignore-installed 'fitsio${{ matrix.fitsio-version }}' 'numba${{ matrix.numba-version }}'
python -m pip install pytest pytest-cov coveralls
- name: Install DESI dependencies
env:
DESIUTIL_VERSION: 3.6.0 # required for astropy 7.x
SPECTER_VERSION: 0.11.0
GPU_SPECTER_VERSION: main
DESIMODEL_VERSION: 0.19.3
DESITARGET_VERSION: main
REDROCK_VERSION: 0.20.4
run: |
# --no-build-isolation needed for older code tags with latest pip/setuputils
python -m pip install --no-build-isolation desiutil==${DESIUTIL_VERSION}
python -m pip install --no-build-isolation git+https://github.com/desihub/desimodel.git@${DESIMODEL_VERSION}
python -m pip install --no-build-isolation git+https://github.com/desihub/specter.git@${SPECTER_VERSION}
python -m pip install --no-build-isolation git+https://github.com/desihub/gpu_specter.git@${GPU_SPECTER_VERSION}
python -m pip install --no-build-isolation git+https://github.com/desihub/desitarget.git@${DESITARGET_VERSION}
python -m pip install --no-build-isolation git+https://github.com/desihub/redrock.git@${REDROCK_VERSION}
- name: Install desimodel data
env:
DESIMODEL_DATA: branches/test-0.19
run: install_desimodel_data --desimodel-version ${DESIMODEL_DATA}
- name: Run the test
run: pytest --cov
# 2026-02-27 : Coveralls is having a major outage; skip the coverage upload
### - name: Coveralls
### env:
### COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
### GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
### run: coveralls
desilite:
name: Test minimal env
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
python-version: ['3.10']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel pytest
### python -m pip install astropy scipy numba "numpy<2.0"
### python -m pip install pytest
### python -m pip cache remove fitsio
### python -m pip install --no-deps --force-reinstall --ignore-installed fitsio
### python -m pip install desiutil
### python -m pip install git+https://github.com/desihub/desitarget.git
python -m pip install .
- name: Run just the lite env test
run: pytest py/desispec/test/test_lite.py
docs:
name: Doc test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.10']
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: python -m pip install --upgrade pip setuptools wheel Sphinx sphinx-rtd-theme
# run: python -m pip install --upgrade pip wheel docutils\<0.18 Sphinx==3.1.2
- name: Test the documentation
run: sphinx-build -W --keep-going -b html doc doc/_build/html
api:
name: API doc completeness test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.10']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install desiutil
- name: Generate api.rst
run: desi_api_file --api ./api.rst desispec
- name: Compare generated api.rst to checked-in version
run: diff --ignore-space-change --ignore-blank-lines ./api.rst ./doc/api.rst
style:
name: Style check
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ['3.10']
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: python -m pip install --upgrade pip setuptools wheel pycodestyle
- name: Test the style; failures are allowed
# This is equivalent to an allowed falure.
continue-on-error: true
run: pycodestyle --count py/desispec