Skip to content

Commit b72cfb2

Browse files
authored
Merge pull request #959 from lmfit/numpy2_fixes
Numpy2 fixes
2 parents 7710da6 + 0f23b10 commit b72cfb2

File tree

6 files changed

+17
-19
lines changed

6 files changed

+17
-19
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ exclude: 'doc/conf.py'
22

33
repos:
44
- repo: https://github.com/asottile/pyupgrade
5-
rev: v3.15.2
5+
rev: v3.16.0
66
hooks:
77
- id: pyupgrade
88
args: [--py38-plus]
99

1010
- repo: https://github.com/pre-commit/pre-commit-hooks
11-
rev: v4.5.0
11+
rev: v4.6.0
1212
hooks:
1313
- id: check-ast
1414
- id: check-builtin-literals
@@ -23,7 +23,7 @@ repos:
2323
args: [--remove]
2424

2525
- repo: https://github.com/PyCQA/flake8
26-
rev: 7.0.0
26+
rev: 7.1.0
2727
hooks:
2828
- id: flake8
2929
additional_dependencies: [flake8-deprecated, flake8-mutable, Flake8-pyproject]
@@ -51,14 +51,14 @@ repos:
5151
- id: python-check-blanket-noqa
5252

5353
- repo: https://github.com/codespell-project/codespell
54-
rev: v2.2.6
54+
rev: v2.3.0
5555
hooks:
5656
- id: codespell
5757
files: '.py|.rst'
5858
exclude: 'doc/doc_examples_to_gallery.py|.ipynb'
5959
# escaped characters currently do not work correctly
6060
# so \nnumber is considered a spelling error....
61-
args: ["-L nnumber", "-L mone"]
61+
args: ["-L nnumber", "-L mone", "-L assertIn", "-L efine",]
6262

6363
- repo: https://github.com/asottile/yesqa
6464
rev: v1.5.0

azure-pipelines.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ stages:
8282
displayName: 'Install dependencies'
8383
- script: |
8484
python -m pip install --upgrade build pip wheel
85-
python -m pip install asteval==0.9.28 numpy==1.23.0 scipy==1.8.0 uncertainties==3.1.4
85+
python -m pip install asteval==1.0 numpy==1.23.0 scipy==1.8.0 uncertainties==3.2.2
8686
displayName: 'Install minimum required version of dependencies'
8787
- script: |
8888
python -m build
@@ -256,7 +256,7 @@ stages:
256256
displayName: 'Install build, pip, setuptools, wheel, pybind11, and cython'
257257
- script: |
258258
export PATH=/home/vsts/.local/bin:$PATH
259-
export numpy_version=1.26.4
259+
export numpy_version=2.0.0
260260
wget https://github.com/numpy/numpy/releases/download/v${numpy_version}/numpy-${numpy_version}.tar.gz
261261
tar xzvf numpy-${numpy_version}.tar.gz
262262
cd numpy-${numpy_version}
@@ -269,7 +269,7 @@ stages:
269269
displayName: 'Install pythran'
270270
- script: |
271271
export PATH=/home/vsts/.local/bin:$PATH
272-
export scipy_version=1.13.0
272+
export scipy_version=1.14.0
273273
wget https://github.com/scipy/scipy/releases/download/v${scipy_version}/scipy-${scipy_version}.tar.gz
274274
tar xzvf scipy-${scipy_version}.tar.gz
275275
cd scipy-${scipy_version}

doc/installation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ Lmfit works with `Python`_ versions 3.8 and higher. Version
3838
Lmfit requires the following Python packages, with versions given:
3939
* `NumPy`_ version 1.23 or higher.
4040
* `SciPy`_ version 1.8 or higher.
41-
* `asteval`_ version 0.9.28 or higher.
42-
* `uncertainties`_ version 3.1.4 or higher.
41+
* `asteval`_ version 1.0 or higher.
42+
* `uncertainties`_ version 3.2.2 or higher.
4343
* `dill`_ version 0.3.4 or higher.
4444

4545
All of these are readily available on PyPI, and are installed

lmfit/parameter.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,8 @@ def __reduce__(self):
181181
params = [self[k] for k in self]
182182

183183
# find the symbols from _asteval.symtable, that need to be remembered.
184-
sym_unique = self._asteval.user_defined_symbols()
185184
unique_symbols = {key: deepcopy(self._asteval.symtable[key])
186-
for key in sym_unique}
185+
for key in self._asteval.user_defined_symbols()}
187186

188187
return self.__class__, (), {'unique_symbols': unique_symbols,
189188
'params': params}
@@ -567,9 +566,8 @@ def dumps(self, **kws):
567566
568567
"""
569568
params = [p.__getstate__() for p in self.values()]
570-
sym_unique = self._asteval.user_defined_symbols()
571569
unique_symbols = {key: encode4js(deepcopy(self._asteval.symtable[key]))
572-
for key in sym_unique}
570+
for key in self._asteval.user_defined_symbols()}
573571
return json.dumps({'unique_symbols': unique_symbols,
574572
'params': params}, **kws)
575573

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ build-backend = "setuptools.build_meta"
66
name = "lmfit"
77
dynamic = ["version"]
88
dependencies = [
9-
"asteval>=0.9.28",
9+
"asteval>=1.0",
1010
"numpy>=1.19",
1111
"scipy>=1.6",
12-
"uncertainties>=3.1.4",
13-
"dill>=0.3.4"
12+
"uncertainties>=3.2.2",
13+
"dill>=0.3.4",
1414
]
1515
requires-python = ">= 3.8"
1616
authors = [
@@ -110,7 +110,7 @@ force_sort_within_sections = "True"
110110
[tool.rstcheck]
111111
report_level = "WARNING"
112112
ignore_substitutions = [
113-
"release"
113+
"release",
114114
]
115115
ignore_roles = [
116116
"scipydoc",

tests/test_model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ def test_independent_var_parsing(self):
900900
yatan = stepmod2.eval(pars, x=x)
901901

902902
assert (yatan-yline).std() > 0.1
903-
assert (yatan-yline).ptp() > 1.0
903+
assert np.ptp(yatan-yline) > 1.0
904904

905905
voigtmod = Model(voigt)
906906
assert 'x' in voigtmod.independent_vars

0 commit comments

Comments
 (0)