Skip to content

Commit 2764950

Browse files
authored
Environment pinning (#985)
Pin environment definitions with [`conda-lock`](https://github.com/conda/conda-lock) * Add conda environment definitions * Add multi-platform lockfiles produced by `conda-lock lock` * Add single-platform explicit lockfiles from `conda-lock render` * Convert azure pipeline to use conda-lock lockfiles * Pin PETSc on macOS Linkage between petsc 3.20.2_*_102 and scotch 7.0 is broken. conda-forge/petsc-feedstock#180 * Document different triggers * Document use of lockfiles
1 parent fcf3dfb commit 2764950

26 files changed

+32859
-127
lines changed

.azure/pipelines.yml

+12-52
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
44
# https://docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/anaconda
55

6+
# test every commit (implicit branches and explicit tags) for breaking
7+
# changes in commit
68
trigger:
79
tags:
810
include:
911
- '*'
1012

13+
# test master nightly for breaking changes in dependencies
1114
schedules:
1215
- cron: "0 0 * * *"
1316
displayName: Daily midnight build
@@ -34,13 +37,8 @@ stages:
3437
steps:
3538
- template: templates/install.yml
3639
parameters:
37-
python_version: 3
3840
conda_packages: 'hunspell'
39-
40-
- bash: |
41-
source activate myEnvironment
42-
pip install pyspelling
43-
displayName: Install pip packages
41+
pip_packages: pyspelling
4442

4543
- bash: |
4644
wget -O en_US.aff https://cgit.freedesktop.org/libreoffice/dictionaries/plain/en/en_US.aff?id=a4473e06b56bfe35187e302754f6baaa8d75e54f
@@ -62,13 +60,8 @@ stages:
6260
steps:
6361
- template: templates/install.yml
6462
parameters:
65-
python_version: 3
6663
conda_packages: 'numpy'
67-
68-
- bash: |
69-
source activate myEnvironment
70-
pip install pylint
71-
displayName: Install pip packages
64+
pip_packages: pylint
7265

7366
- bash: |
7467
source activate myEnvironment
@@ -85,13 +78,8 @@ stages:
8578
steps:
8679
- template: templates/install.yml
8780
parameters:
88-
python_version: 3
8981
conda_packages: 'numpy'
90-
91-
- bash: |
92-
source activate myEnvironment
93-
pip install flake8
94-
displayName: Install pip packages
82+
pip_packages: flake8
9583

9684
- bash: |
9785
source activate myEnvironment
@@ -106,74 +94,50 @@ stages:
10694
matrix:
10795
linux-py3k-petsc:
10896
image: ubuntu-latest
109-
python_version: 3
110-
conda_packages: 'numpy scipy matplotlib-base future packaging mpich mpi4py petsc4py mayavi "gmsh <4.0|>=4.5.2"'
11197
FIPY_SOLVERS: petsc
11298
MPIRUN:
11399
linux-py3k-petsc-parallel:
114100
image: ubuntu-latest
115-
python_version: 3
116-
conda_packages: 'numpy scipy matplotlib-base future packaging mpich mpi4py petsc4py mayavi "gmsh <4.0|>=4.5.2"'
117101
FIPY_SOLVERS: petsc
118102
MPIRUN: 'mpirun -np 2'
119103
linux-py3k-scipy:
120104
image: ubuntu-latest
121-
python_version: 3
122-
conda_packages: 'numpy scipy matplotlib-base future packaging mayavi "gmsh <4.0|>=4.5.2"'
123105
FIPY_SOLVERS: scipy
124106
MPIRUN:
125107
linux-py3k-trilinos:
126108
image: ubuntu-latest
127-
python_version: 3
128-
conda_packages: 'numpy scipy matplotlib-base future packaging mpich mpi4py pytrilinos mayavi "gmsh <4.0|>=4.5.2"'
129109
FIPY_SOLVERS: trilinos
130110
MPIRUN:
131111
linux-py3k-trilinos-parallel:
132112
image: ubuntu-latest
133-
python_version: 3
134-
conda_packages: 'numpy scipy matplotlib-base future packaging mpich mpi4py pytrilinos mayavi "gmsh <4.0|>=4.5.2"'
135113
FIPY_SOLVERS: trilinos
136114
MPIRUN: 'mpirun -np 2'
137115
macos-py27-pysparse:
138116
image: macos-latest
139-
python_version: 2.7
140-
conda_packages: 'numpy scipy matplotlib-base future packaging pysparse mayavi "traitsui<7.0.0" "gmsh<4.0"'
141117
FIPY_SOLVERS: pysparse
142118
MPIRUN:
143119
macos-py3k-petsc:
144120
image: macos-latest
145-
python_version: 3
146-
conda_packages: 'numpy scipy matplotlib-base future packaging mpich mpi4py petsc4py mayavi "gmsh <4.0|>=4.5.2"'
147121
FIPY_SOLVERS: petsc
148122
MPIRUN:
149123
macos-py3k-petsc-parallel:
150124
image: macos-latest
151-
python_version: 3
152-
conda_packages: 'numpy scipy matplotlib-base future packaging mpich mpi4py petsc4py mayavi "gmsh <4.0|>=4.5.2"'
153125
FIPY_SOLVERS: petsc
154126
MPIRUN: 'mpirun -np 2'
155127
macos-py3k-scipy:
156128
image: macos-latest
157-
python_version: 3
158-
conda_packages: 'numpy scipy matplotlib-base future packaging mayavi "gmsh <4.0|>=4.5.2"'
159129
FIPY_SOLVERS: scipy
160130
MPIRUN:
161131
macos-py3k-trilinos:
162132
image: macos-latest
163-
python_version: 3
164-
conda_packages: 'numpy scipy matplotlib-base future packaging mpich mpi4py pytrilinos mayavi "gmsh <4.0|>=4.5.2"'
165133
FIPY_SOLVERS: trilinos
166134
MPIRUN:
167135
macos-py3k-trilinos-parallel:
168136
image: macos-latest
169-
python_version: 3
170-
conda_packages: 'numpy scipy matplotlib-base future packaging mpich mpi4py pytrilinos mayavi "gmsh <4.0|>=4.5.2"'
171137
FIPY_SOLVERS: trilinos
172138
MPIRUN: 'mpirun -np 2'
173139
windows-py3k-scipy:
174140
image: windows-latest
175-
python_version: 3
176-
conda_packages: 'numpy scipy matplotlib-base future packaging mayavi "gmsh <4.0|>=4.5.2"'
177141
FIPY_SOLVERS: scipy
178142
MPIRUN:
179143

@@ -183,12 +147,13 @@ stages:
183147
steps:
184148
- template: templates/install.yml
185149
parameters:
186-
python_version: $(python_version)
187-
conda_packages: $(conda_packages)
150+
solver: $(FIPY_SOLVERS)
188151

189152
- bash: |
190-
conda env export --name myEnvironment
191-
displayName: Environment
153+
source activate myEnvironment
154+
# OK if this fails
155+
pip install scikit-fmm || true
156+
displayName: Install pip packages
192157
193158
- bash: |
194159
source activate myEnvironment
@@ -209,14 +174,10 @@ stages:
209174
matrix:
210175
unix:
211176
image: ubuntu-latest
212-
python_version: 3.10
213-
conda_packages: 'numpy scipy matplotlib-base future packaging mpich mpi4py petsc4py mayavi "gmsh <4.0|>=4.5.2"'
214177
FIPY_SOLVERS: petsc
215178
MPIRUN:
216179
windows:
217180
image: windows-latest
218-
python_version: 3.10
219-
conda_packages: 'numpy scipy matplotlib-base future packaging mayavi "gmsh <4.0|>=4.5.2"'
220181
FIPY_SOLVERS: scipy
221182
MPIRUN:
222183

@@ -226,8 +187,7 @@ stages:
226187
steps:
227188
- template: templates/install.yml
228189
parameters:
229-
python_version: $(python_version)
230-
conda_packages: $(conda_packages)
190+
solver: $(FIPY_SOLVERS)
231191

232192
- bash: git fetch origin --tags --force
233193
displayName: Fetch tags

.azure/templates/install.yml

+38-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
parameters:
2-
- name: python_version
3-
type: string
4-
default: 3.9
52
- name: conda_packages
63
type: string
74
default: ''
5+
- name: pip_packages
6+
type: string
7+
default: ''
8+
- name: solver
9+
type: string
10+
default: scipy
811

912
steps:
1013
- bash: echo "##vso[task.prependpath]$CONDA/bin"
@@ -32,16 +35,42 @@ steps:
3235
conda config --set always_yes yes --set changeps1 no
3336
conda config --remove channels defaults
3437
conda config --set solver libmamba
35-
displayName: Create Anaconda environment
38+
displayName: Configure Anaconda
39+
40+
# Most triggered builds use lockfile to ensure failures are
41+
# due to commit and not due to dependencies
42+
- bash: |
43+
conda install --channel=conda-forge --name=base conda-lock
44+
conda-lock install --name myEnvironment \
45+
environments/locks/conda-${{ parameters.solver }}-lock.yml
46+
displayName: Create Anaconda environment from lockfile
47+
condition: not(eq(variables['Build.CronSchedule.DisplayName'], 'Daily midnight build'))
3648
49+
# Daily midnight build uses environment.yml files to catch regressions
50+
# due to updates in dependencies
3751
- bash: |
38-
conda create --yes --quiet --name myEnvironment --channel conda-forge python=${{ parameters.python_version }} ${{ parameters.conda_packages }}
52+
conda env create --name myEnvironment \
53+
--file environments/${{ parameters.solver }}-environment.yml
54+
displayName: Create Anaconda environment from environments
55+
condition: eq(variables['Build.CronSchedule.DisplayName'], 'Daily midnight build')
56+
57+
- bash: |
58+
if [[ "${{ parameters.conda_packages }}" != "" ]]; then
59+
source activate myEnvironment
60+
# "Libmamba only supports a subset of the MatchSpec interface for
61+
# now. You can only use ('name', 'version', 'build', 'channel',
62+
# 'subdir'), but you tried to use ('md5',)."
63+
conda install --solver classic --channel conda-forge ${{ parameters.conda_packages }}
64+
fi
3965
displayName: Install Anaconda packages
4066
4167
- bash: |
42-
if [[ ${{ parameters.python_version }} != "2.7" ]]; then
68+
if [[ "${{ parameters.pip_packages }}" != "" ]]; then
4369
source activate myEnvironment
44-
pip install scikit-fmm
45-
pip install packaging
70+
python -m pip install ${{ parameters.pip_packages }}
4671
fi
47-
displayName: Install pip packages
72+
displayName: Install Pip packages
73+
74+
- bash: |
75+
conda env export --name myEnvironment
76+
displayName: Environment

.en-custom.txt

+1
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ linearize
183183
linearizing
184184
liquidus
185185
Lobkovsky
186+
lockfiles
186187
LSMLIB
187188
MacBook
188189
Malalasekera

0 commit comments

Comments
 (0)