Repository navigation
Support NumPy 2, Python 3.12 and modern build tooling - #111
Open
Charles-delapore wants to merge 7 commits into
Open
Charles-delapore wants to merge 7 commits into
Charles-delapore wants to merge 7 commits into
Conversation
- replace removed aliases: np.float, np.int, np.asscalar - unpin numpy<2; require numpy>=1.20 and Python >=3.9 (classifiers 3.9-3.12) - setuptools_scm 8 and setuptools>=61; drop version = attr: (SCM owns it) - importlib.metadata instead of pkg_resources; tolerate a plain source checkout
The avseth test passed pure-gas fluid properties while its sibling smith test uses sw = 0.3, so the two implementations disagreed by 29 m/s. Use the same Wood-mixed fluid; vp/vs now agree to 0.16% and match Smith et al. 2003. The rho expectation (2210) is a figure-read value 1.0% below what both methods compute (2232.07) from the test's own inputs, so relax it to places=-2 (|diff| < 50 vs observed 22.07).
The script called TextTestRunner.run() and then fell off the end, so it always exited 0 even when tests failed. Return the result status via sys.exit, and anchor discovery to the script directory so it works from any working directory.
unittest.discover raises 'Start directory is not importable' on the bruges/*/test directories before Python 3.12, and the old script ignored the result entirely, so it always exited 0. Use pytest (already a test dependency), which finds the *test.py modules on 3.9-3.13, and return its exit code.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
bruges0.5.4 cannot be installed or tested on a current stack:numpy<2and uses aliases removed in NumPy 2 (np.float,np.int,np.asscalar).assertAlmostEquals, removed in Python 3.12.pkg_resourcesis gone in setuptools 82+, andsetuptools_scm4–5 cannot build under modern setuptools, sopip install .fails.What changed
np.float/np.int/np.asscalar;numpy<2→numpy>=1.20;python_requires >=3.9; classifiers 3.9–3.12.setuptools>=61,setuptools_scm[toml]>=8; dropversion = attr:(the SCM version owns it);importlib.metadatainstead ofpkg_resources; a plain source checkout imports with0.0.0+unknowninstead of raising.assertAlmostEquals→assertAlmostEqual.test_avsethpassed pure-gas properties while the siblingtest_smithusessw = 0.3; that made the two implementations disagree by 29 m/s. Both now use the same Wood-mixed fluid and agree to 0.16%, matching Smith et al. (2003). The rho expectation (2210) is a figure-read value 1.0% below what both methods compute (2232.07) from the test's own inputs, so it is relaxed toplaces=-2(|diff| < 50 vs observed 22.07).main.No library algorithm is changed. Outside tests, the diff is alias replacements and version handling only.
Verification
python run_tests.py: 56 tests, OK on Python 3.13.13 + NumPy 2.5.4 (SciPy 1.18.1).uv buildproduces an sdist and wheel from a clean checkout;pip install .works with default build isolation.The fluid-test change is independent; it can be dropped or reviewed separately if you prefer to keep this PR to NumPy 2 only.