Skip to content

Commit 0ad25cf

Browse files
committed
Merge branch 'master' into pbrubeck/interpolate-mixed
2 parents ad323d1 + 659ad4d commit 0ad25cf

File tree

9 files changed

+64
-83
lines changed

9 files changed

+64
-83
lines changed

.github/workflows/core.yml

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ jobs:
169169
pip cache remove slepc4py
170170
171171
if [ ${{ inputs.target_branch }} = 'release' ]; then
172+
EXTRA_BUILD_ARGS=''
172173
EXTRA_PIP_FLAGS=''
173174
else
174175
: # Install build dependencies
@@ -182,18 +183,34 @@ jobs:
182183
pip install --no-deps ngsPETSc netgen-mesher netgen-occt
183184
184185
: # We have to pass '--no-build-isolation' to use a custom petsc4py
186+
EXTRA_BUILD_ARGS='--no-isolation'
185187
EXTRA_PIP_FLAGS='--no-build-isolation'
186188
fi
187189
190+
: # Install from an sdist so we can make sure that it is not ill-formed
191+
pip install build
192+
python -m build ./firedrake-repo --sdist "$EXTRA_BUILD_ARGS"
193+
188194
pip install --verbose $EXTRA_PIP_FLAGS \
189195
--no-binary h5py \
190196
--extra-index-url https://download.pytorch.org/whl/cpu \
191-
'./firedrake-repo[ci,docs]'
197+
"$(echo ./firedrake-repo/dist/firedrake-*.tar.gz)[ci,docs]"
192198
193199
pip install -I "fenics-ufl @ git+https://github.com/firedrakeproject/ufl.git@pbrubeck/fix/baseform"
194200
firedrake-clean
195201
pip list
196202
203+
- name: Upload sdist (default ARCH only)
204+
if: matrix.arch == 'default'
205+
uses: actions/upload-artifact@v4
206+
with:
207+
name: dist
208+
path: firedrake-repo/dist/*
209+
210+
- name: Report sdist build status
211+
id: report_sdist
212+
run: echo "conclusion=success" >> "$GITHUB_OUTPUT"
213+
197214
- name: Run firedrake-check
198215
run: |
199216
. venv/bin/activate
@@ -340,32 +357,6 @@ jobs:
340357
name: firedrake-logs-${{ matrix.arch }}
341358
path: pytest_*.log
342359

343-
- name: Build sdist (release only)
344-
if: |
345-
inputs.target_branch == 'release' &&
346-
matrix.arch == 'default' &&
347-
(success() || steps.install.conclusion == 'success')
348-
run: |
349-
. venv/bin/activate
350-
pip install build
351-
python -m build ./firedrake-repo --sdist
352-
353-
- name: Upload sdist (release only)
354-
id: upload_sdist
355-
if: |
356-
inputs.target_branch == 'release' &&
357-
matrix.arch == 'default' &&
358-
(success() || steps.install.conclusion == 'success')
359-
uses: actions/upload-artifact@v4
360-
with:
361-
name: dist
362-
path: firedrake-repo/dist/*
363-
364-
- name: Report sdist build status
365-
id: report_sdist
366-
if: success() || steps.upload_sdist.conclusion == 'success'
367-
run: echo "conclusion=success" >> "$GITHUB_OUTPUT"
368-
369360
- name: Check bibtex
370361
if: (success() || steps.install.conclusion == 'success') && matrix.arch == 'default'
371362
run: |

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ __pycache__/
2727
/docs/source/demos
2828
/firedrake/cython/*.c
2929
/firedrake.egg-info
30-
/firedrake_check/
30+
/firedrake/_check/Makefile
31+
/firedrake/_check/tests
3132
/docs/source/element_list.csv
3233

3334

MANIFEST.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file contains all the non-standard files that need to be included
2+
# in the source distribution.
3+
4+
recursive-include firedrake/cython *.pyx *.pxi
5+
recursive-exclude firedrake/cython *.c

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,13 @@ clean:
8888
@echo " RM tinyasm/*.so"
8989
-@rm -f tinyasm/*.so > /dev/null 2>&1
9090

91-
# Do verbose checking if running on CI
91+
# Do verbose checking if running on CI and always set no:cacheprovider because
92+
# we don't want to generate any cache files in $VIRTUAL_ENV/lib/.../firedrake/_check
9293
check_flags =
9394
ifeq ($(FIREDRAKE_CI), 1)
94-
check_flags = --verbose
95+
check_flags = --verbose -p no:cacheprovider
9596
else
96-
check_flags = --quiet
97+
check_flags = --quiet -p no:cacheprovider
9798
endif
9899

99100
CHECK_PYTEST_ARGS =

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
r'https://www.tuomaskarna.com',
163163
r'https://www.crosscountrytrains.co.uk/',
164164
r'https://www.siam.org/',
165-
r'https://aims.ac.rw/',
165+
r'https://aims.ac.rw',
166166
]
167167
linkcheck_timeout = 30
168168

docs/source/install.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ install Firedrake. To do this perform the following steps:
180180
#. Install Firedrake::
181181

182182
$ pip cache remove petsc4py
183-
$ pip install --no-binary h5py "firedrake @ git+https://github.com/firedrakeproject/firedrake.git@release#[check]"
183+
$ pip install --no-binary h5py 'firedrake[check]'
184184

185185
.. note::
186186
Though not strictly necessary to install Firedrake's optional
@@ -219,7 +219,7 @@ Updating Firedrake involves following the same steps as above when
219219
:ref:`installing Firedrake<install_firedrake>`. First, use ``firedrake-configure``
220220
to set the right environment variables and then run::
221221

222-
$ pip install --upgrade git+https://github.com/firedrakeproject/firedrake.git@release
222+
$ pip install --upgrade firedrake
223223

224224
Updating PETSc
225225
~~~~~~~~~~~~~~
@@ -326,15 +326,15 @@ To install Firedrake with SLEPc support you should:
326326
and install Firedrake with the ``slepc`` optional dependency. For example::
327327

328328
$ pip cache remove slepc4py
329-
$ pip install --no-binary h5py "firedrake @ git+https://github.com/firedrakeproject/firedrake.git@release#[check,slepc]"
329+
$ pip install --no-binary h5py 'firedrake[check,slepc]'
330330

331331
VTK
332332
~~~
333333

334334
To install Firedrake with VTK, it should be installed using the ``vtk`` optional
335335
dependency. For example::
336336

337-
$ pip install --no-binary h5py "firedrake @ git+https://github.com/firedrakeproject/firedrake.git@release#[check,vtk]"
337+
$ pip install --no-binary h5py 'firedrake[check,vtk]'
338338

339339
At present VTK wheels are not available for ARM Linux machines. Depending on your
340340
Python version you may be able to work around this by downloading and pip installing
@@ -348,7 +348,7 @@ PyTorch
348348
To install Firedrake with `PyTorch <https://pytorch.org/>`_, it should be installed
349349
using the ``torch`` optional dependency. For example::
350350

351-
$ pip install --no-binary h5py "firedrake @ git+https://github.com/firedrakeproject/firedrake.git@release#[check,torch]" --extra-index-url https://download.pytorch.org/whl/cpu
351+
$ pip install --no-binary h5py 'firedrake[check,torch]' --extra-index-url https://download.pytorch.org/whl/cpu
352352

353353
Observe that, in addition to specifying ``torch``, an additional
354354
argument (``--extra-index-url``) is needed. More information on installing
@@ -361,7 +361,7 @@ JAX
361361
To install Firedrake with JAX, it should be installed using the ``jax`` optional
362362
dependency. For example::
363363

364-
$ pip install --no-binary h5py "firedrake @ git+https://github.com/firedrakeproject/firedrake.git@release#[check,jax]"
364+
$ pip install --no-binary h5py 'firedrake[check,jax]'
365365

366366

367367
Netgen
@@ -370,7 +370,7 @@ Netgen
370370
To install Firedrake with `Netgen <https://ngsolve.org/>`_ support, it should be
371371
installed with the ``netgen`` optional dependency. For example::
372372

373-
$ pip install --no-binary h5py "firedrake @ git+https://github.com/firedrakeproject/firedrake.git@release#[check,netgen]"
373+
$ pip install --no-binary h5py 'firedrake[check,netgen]'
374374

375375

376376
Customising PETSc

firedrake/_check/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""Run the Firedrake smoke tests."""
2+
3+
import pathlib
4+
import subprocess
5+
6+
7+
def main() -> None:
8+
dir = pathlib.Path(__file__).parent
9+
subprocess.run(f"make -C {dir} check".split(), errors=True)

pyproject.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Repository = "https://github.com/firedrakeproject/firedrake"
6060
Issues = "https://github.com/firedrakeproject/firedrake/issues/new/choose"
6161

6262
[project.scripts]
63-
firedrake-check = "firedrake_check:main"
63+
firedrake-check = "firedrake._check:main"
6464
firedrake-clean = "firedrake.scripts.firedrake_clean:main"
6565
firedrake-preprocess-bibtex = "firedrake.scripts.firedrake_preprocess_bibtex:main"
6666
firedrake-status = "firedrake.scripts.firedrake_status:main"
@@ -168,11 +168,7 @@ firedrake = [
168168
"evaluate.h",
169169
"locate.c",
170170
"icons/*.png",
171-
]
172-
firedrake_check = [
173-
"Makefile",
174-
"tests/firedrake/conftest.py",
175-
"tests/*/*/*.py",
171+
"_check/**",
176172
]
177173
pyop2 = [
178174
"*.h",

setup.py

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import pkgconfig
1313
from dataclasses import dataclass, field
1414
from setuptools import setup, find_packages, Extension
15+
from setuptools.command.sdist import sdist as _sdist
1516
from glob import glob
1617
from pathlib import Path
1718
from Cython.Build import cythonize
@@ -236,7 +237,9 @@ def extensions():
236237

237238

238239
# TODO: It would be good to have a single source of truth for these files
239-
FIREDRAKE_CHECK_TEST_FILES = (
240+
FIREDRAKE_CHECK_FILES = (
241+
"Makefile",
242+
"tests/firedrake/conftest.py",
240243
"tests/firedrake/regression/test_stokes_mini.py",
241244
"tests/firedrake/regression/test_locate_cell.py",
242245
"tests/firedrake/supermesh/test_assemble_mixed_mass_matrix.py",
@@ -247,46 +250,21 @@ def extensions():
247250
)
248251

249252

250-
# This diabolical function is needed to allow 'firedrake-check' to work. Since
251-
# installed packages are not allowed to contain files from outside that Python
252-
# package we cannot access the Makefile or test files once installation is
253-
# complete. Therefore, before we install, we create a dummy package, called
254-
# 'firedrake-check' containing said Makefile and tests.
255-
def make_firedrake_check_package():
256-
package_dir = "firedrake_check"
257-
logging.info(f"Creating '{package_dir}' package")
258-
if os.path.exists(package_dir):
259-
logging.info(f"'{package_dir}' already found, removing")
260-
shutil.rmtree(package_dir)
253+
class sdist(_sdist):
254+
def run(self):
255+
self._copy_check_files()
256+
super().run()
261257

262-
os.mkdir(package_dir)
263-
with open(f"{package_dir}/__init__.py", "w") as f:
264-
# set 'errors=True' to make sure that we propagate failures to the
265-
# outer process
266-
f.write("""import pathlib
267-
import subprocess
268-
269-
def main():
270-
dir = pathlib.Path(__file__).parent
271-
subprocess.run(f'make -C {dir} check'.split(), errors=True)
272-
""")
273-
274-
# copy Makefile and tests into dummy package
275-
shutil.copy("Makefile", package_dir)
276-
for test_file in FIREDRAKE_CHECK_TEST_FILES:
277-
package_test_dir = os.path.join(package_dir, Path(test_file).parent)
278-
os.makedirs(package_test_dir, exist_ok=True)
279-
shutil.copy(test_file, package_test_dir)
280-
281-
# Also copy conftest.py so any markers are recognised
282-
conftest_dir = os.path.join(package_dir, "tests", "firedrake")
283-
shutil.copy("tests/firedrake/conftest.py", conftest_dir)
284-
285-
286-
make_firedrake_check_package()
258+
def _copy_check_files(self):
259+
"""Copy Makefile and tests into firedrake/_check."""
260+
dest_dir = Path("firedrake/_check")
261+
for check_file in map(Path, FIREDRAKE_CHECK_FILES ):
262+
os.makedirs(dest_dir / check_file.parent, exist_ok=True)
263+
shutil.copy(check_file, dest_dir / check_file.parent)
287264

288265

289266
setup(
267+
cmdclass={"sdist": sdist},
290268
packages=find_packages(),
291-
ext_modules=extensions()
269+
ext_modules=extensions(),
292270
)

0 commit comments

Comments
 (0)