Skip to content

Commit 66774ea

Browse files
guyerwd15
andauthored
Fixes for Python 3.12, NumPy 2.0, and SciPy 1.14 (#1050)
* Monkeypatch versioneer.py - Python 3.12 doesn't like SafeConfigParser - Python 2.7 doesn't like versioneer > 0.18 * Replace obj2sctype * Replace `.getsctype()` with `.dtype` * Replace `NUMERIX.issubclass_()` with `issubclass()` * Replace `itemset()` with indexing * Fix obsolete name for infinity * Fix comparison operator representation * Use `ins.argrepr` for representation of operator variables * Remove future.standard_library This library no longer exists in Python 3.12 It looks like it isn't even needed in Python 2.7 to use pickle and redirecting_html.py should go away (but fixed it anyway). * Update locks * Add `return_scalar` to `__array_wrap__` for NumPy 2.0 * Add `copy=` argument to `__array__` for NumPy 2.0 * Address `copy=None` for NumPy < 2.0 Based on https://github.com/scipy/scipy/pull/20172/files as suggested by https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword * Defer return_scalar for OperatorVariables * Replace deprecated `numpy.in1d` with `numpy.isin` * Replace deprecated `tol=` with `rtol=` to SciPy Krylov solvers * Replace deprecated `atol='legacy'` for SciPy Krylov solves * Remove internal implementation details of numpy.array2string * Override legacy formatting set for tests * Lock out petsc 3.21 petsc(4py) 3.21.2 crashes when running tests in parallel: ``` mesh2D (examples.cahnHilliard) Doctest: examples.cahnHilliard.mesh2D ... Internal error 1 in DMUMPS_LOAD_RECV_MSGS 1 Internal error 1 in DMUMPS_LOAD_RECV_MSGS 1 Internal error 2 in DMUMPS_LOAD_RECV_MSGS 1275068685 52 Internal error 1 in DMUMPS_LOAD_PROCESS_MESSAGE Internal error 1 in DMUMPS_LOAD_RECV_MSGS 1 Abort(-99) on node 0 (rank 0 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, -99) - process 0 Abort(-99) on node 1 (rank 1 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, -99) - process 1 Abort(-99) on node 1 (rank 1 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, -99) - process 1 Abort(-99) on node 0 (rank 0 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, -99) - process 0 Abort(-99) on node 0 (rank 0 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, -99) - process 0 Abort(-99) on node 0 (rank 0 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, -99) - process 0 Abort(-99) on node 1 (rank 1 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, -99) - process 1 Abort(-99) on node 1 (rank 1 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, -99) - process 1 Abort(-99) on node 1 (rank 1 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, -99) - process 1 Abort(-99) on node 0 (rank 0 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, -99) - process 0 Abort(-99) on node 1 (rank 1 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, -99) - process 1 Abort(-99) on node 1 (rank 1 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, -99) - process 1 Abort(-99) on node 1 (rank 1 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, -99) - process 1 Abort(-99) on node 0 (rank 0 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, -99) - process 0 Abort(-99) on node 0 (rank 0 in comm 0): application called MPI_Abort(MPI_COMM_WORLD, -99) - process 0 Internal error 1 in DMUMPS_LOAD_PROCESS_MESSAGE Internal error 1 in DMUMPS_LOAD_RECV_MSGS 1 Internal error 2 in DMUMPS_LOAD_RECV_MSGS 1275068685 52 Internal error 1 in DMUMPS_LOAD_PROCESS_MESSAGE Internal error 1 in DMUMPS_LOAD_RECV_MSGS 1 Internal error 1 in DMUMPS_LOAD_PROCESS_MESSAGE Internal error 1 in DMUMPS_LOAD_RECV_MSGS 1 Internal error 2 in DMUMPS_LOAD_RECV_MSGS 1275068685 52 Internal error 1 in DMUMPS_LOAD_PROCESS_MESSAGE Internal error 1 in DMUMPS_LOAD_RECV_MSGS 1 ``` * Make directory that already exists * Fix case of tarball * Fix type of int Variable for Windows * build(nix): update to python 3.12 and nixos 24.05 Update Nix build to use Python 3.12, NixOS 24.05. Also, include aarch4-darwin as a possible build. Currently, there is a single test failure in fipy.matrices.scipyMatrix._ScipyMatrix. * ci(actions): generate egg_info Generate the egg_info before executing the tests otherwise setup.py doesn't register the correct version of the test suite, but possibly the older version already available in nixpkgs. --------- Co-authored-by: Daniel Wheeler <daniel.wheeler2@gmail.com>
1 parent 6236076 commit 66774ea

37 files changed

+10227
-7180
lines changed

.azure/pipelines.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ stages:
220220
- bash: |
221221
conda create --quiet --name wheelEnvironment --channel conda-forge python=3.10
222222
source activate wheelEnvironment
223-
mkdir tmp
223+
mkdir -p tmp
224224
cd tmp
225225
python -m pip install ../dist/*.whl
226226
FIPY_SOLVERS=scipy python -c "import fipy; fipy.test()"
@@ -232,11 +232,11 @@ stages:
232232
- bash: |
233233
source activate myEnvironment
234234
FIPY_VERSION=`python setup.py --version`
235-
mkdir tmp
235+
mkdir -p tmp
236236
cd tmp
237-
cp ../dist/FiPy-${FIPY_VERSION}.tar.gz .
238-
tar zxvf FiPy-${FIPY_VERSION}.tar.gz
239-
cd FiPy-${FIPY_VERSION}
237+
cp ../dist/fipy-${FIPY_VERSION}.tar.gz .
238+
tar zxvf fipy-${FIPY_VERSION}.tar.gz
239+
cd fipy-${FIPY_VERSION}
240240
python setup.py install
241241
cd ..
242242
python -c "import fipy; fipy.test()"
@@ -248,7 +248,7 @@ stages:
248248
- bash: |
249249
source activate myEnvironment
250250
FIPY_VERSION=`python setup.py --version`
251-
mkdir tmp
251+
mkdir -p tmp
252252
cd tmp
253253
cp ../dist/FiPy-${FIPY_VERSION}.zip .
254254
unzip FiPy-${FIPY_VERSION}.zip

.github/workflows/nix.yml

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
with:
2424
path: /run/user/${{ env.UID }}/http_cache.sqlite
2525
key: ${{ runner.os }}-http_cache.sqlite
26+
- run: nix develop --command bash -c "python setup.py egg_info"
2627
- run: nix develop --command bash -c "python setup.py test"
2728
- run: nix develop --command bash -c "py.test --nbval --nbval-sanitize-with examples/sanitize.cfg examples/index.ipynb"
2829
- uses: actions/cache/save@v3

docs/source/sphinxext/redirecting_html.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from __future__ import unicode_literals
2-
from future import standard_library
3-
standard_library.install_aliases()
42
from docutils import nodes
5-
import urllib.parse
6-
3+
try:
4+
from urllib.parse import urlparse
5+
except ImportError:
6+
from urlparse import urlparse
77
from sphinx.builders.html import StandaloneHTMLBuilder
88

99
class RedirectingHTMLBuilder(StandaloneHTMLBuilder):
@@ -17,7 +17,7 @@ def write_doc(self, docname, doctree):
1717
for node in doctree.traverse(nodes.reference):
1818
try:
1919
uri = node['refuri']
20-
uri = urllib.parse.urlparse(uri)
20+
uri = urlparse(uri)
2121
if uri.scheme in ["http", "https"]:
2222
if not uri.netloc.endswith("nist.gov"):
2323
node['refuri'] = "/cgi-bin/redirect.py?url=" + uri.geturl()

environments/locks/conda-petsc-linux-64.lock

+175-147
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)