daftar 0.3.1__tar.gz → 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {daftar-0.3.1 → daftar-0.3.2}/CHANGELOG.md +19 -0
- {daftar-0.3.1/src/daftar.egg-info → daftar-0.3.2}/PKG-INFO +1 -1
- {daftar-0.3.1 → daftar-0.3.2}/TROUBLESHOOTING.md +68 -0
- {daftar-0.3.1 → daftar-0.3.2}/pyproject.toml +1 -1
- daftar-0.3.2/src/daftar/__version__.py +1 -0
- {daftar-0.3.1 → daftar-0.3.2/src/daftar.egg-info}/PKG-INFO +1 -1
- {daftar-0.3.1 → daftar-0.3.2}/tests/test_adapters_live.py +71 -4
- daftar-0.3.1/src/daftar/__version__.py +0 -1
- {daftar-0.3.1 → daftar-0.3.2}/LICENSE +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/MANIFEST.in +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/PUBLISHING.md +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/README.md +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/ROADMAP.md +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/examples/adapter_usage.py +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/examples/daftar_in_notebooks.ipynb +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/examples/demo_end_to_end.py +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/setup.cfg +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/src/daftar/__init__.py +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/src/daftar/adapters/__init__.py +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/src/daftar/adapters/base.py +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/src/daftar/adapters/brian2_adapter.py +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/src/daftar/adapters/cpm_adapter.py +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/src/daftar/adapters/jaxley_adapter.py +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/src/daftar/adapters/meltingpot_adapter.py +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/src/daftar/capture.py +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/src/daftar/cli.py +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/src/daftar/diff.py +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/src/daftar/manifest.py +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/src/daftar/notebook.py +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/src/daftar/run.py +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/src/daftar/store.py +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/src/daftar/sweep.py +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/src/daftar.egg-info/SOURCES.txt +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/src/daftar.egg-info/dependency_links.txt +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/src/daftar.egg-info/entry_points.txt +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/src/daftar.egg-info/requires.txt +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/src/daftar.egg-info/top_level.txt +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/tests/test_core.py +0 -0
- {daftar-0.3.1 → daftar-0.3.2}/tests/test_notebook.py +0 -0
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.2
|
|
4
|
+
|
|
5
|
+
**cpm live tests now skip with an explanation instead of failing** when cpm and
|
|
6
|
+
SciPy disagree. cpm 0.25.6 passes `disp=` to `fmin_l_bfgs_b`, which SciPy
|
|
7
|
+
removed in 1.18.0, so cpm imports cleanly and raises the moment you fit
|
|
8
|
+
anything.
|
|
9
|
+
|
|
10
|
+
This is the third framework/dependency clash across four adapters — jaxley
|
|
11
|
+
against JAX, brian2 against NumPy, cpm against SciPy — so the preflight logic is
|
|
12
|
+
now a single `_require_working(name, probe)` helper rather than one bespoke
|
|
13
|
+
function per adapter. The rule it encodes: skip for a clash we recognise and can
|
|
14
|
+
explain, fail loudly for anything we do not, because an unrecognised error might
|
|
15
|
+
be our bug and a silent skip would hide it.
|
|
16
|
+
|
|
17
|
+
**Runtime checks are reported separately from import checks.** `daftar doctor`
|
|
18
|
+
answers "does it import", which is fast and usually enough. It is not the same
|
|
19
|
+
question as "does it work": cpm reports `ok` under SciPy 1.18 and then fails on
|
|
20
|
+
the first fit. The adapter status test now prints both.
|
|
21
|
+
|
|
3
22
|
## 0.3.1
|
|
4
23
|
|
|
5
24
|
**A framework that is installed but broken is no longer reported as absent.**
|
|
@@ -225,6 +225,51 @@ wrong".
|
|
|
225
225
|
|
|
226
226
|
---
|
|
227
227
|
|
|
228
|
+
## cpm: `fmin_l_bfgs_b() got an unexpected keyword argument 'disp'`
|
|
229
|
+
|
|
230
|
+
cpm 0.25.6 calls:
|
|
231
|
+
|
|
232
|
+
```python
|
|
233
|
+
result = fmin_l_bfgs_b(objective, x0=..., bounds=bounds,
|
|
234
|
+
args=(model, observed, loss, prior),
|
|
235
|
+
disp=self.display, **self.kwargs)
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
SciPy deprecated `disp` and `iprint` for L-BFGS-B and **removed them in 1.18.0**.
|
|
239
|
+
So cpm imports cleanly and raises the moment you fit anything.
|
|
240
|
+
|
|
241
|
+
If you ran this on an older SciPy you were already warned:
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
DeprecationWarning: scipy.optimize: The `disp` and `iprint` options of the
|
|
245
|
+
L-BFGS-B solver are deprecated and will be removed in SciPy 1.18.0
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**Fix:**
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
pip install "scipy<1.18"
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Then report it upstream — this breaks cpm for every user who upgrades SciPy, and
|
|
255
|
+
the fix is a couple of lines. A template is in the announcement plan; the short
|
|
256
|
+
version is that `disp` should be dropped, or passed only when
|
|
257
|
+
`scipy.__version__ < 1.18`.
|
|
258
|
+
|
|
259
|
+
### Note that `daftar doctor` reports cpm as `ok`
|
|
260
|
+
|
|
261
|
+
Correctly: `import cpm` succeeds. **Importing is not the same as working.**
|
|
262
|
+
`doctor` is a fast import check; the live adapter tests run a real fit and will
|
|
263
|
+
skip with the explanation above. If you want the runtime check on its own:
|
|
264
|
+
|
|
265
|
+
```bash
|
|
266
|
+
pytest tests/test_adapters_live.py -rs -k at_least_report -s
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
which prints both the import status and a runtime usability line per framework.
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
228
273
|
## Brian2: `type object 'numpy.ndarray' has no attribute 'ptp'`
|
|
229
274
|
|
|
230
275
|
Brian2 is installed and imports fail. The adapter tests skip, and older daftar
|
|
@@ -335,6 +380,29 @@ how a broken environment goes unnoticed for weeks.
|
|
|
335
380
|
|
|
336
381
|
---
|
|
337
382
|
|
|
383
|
+
## Why does this keep happening?
|
|
384
|
+
|
|
385
|
+
Three of the four adapters have now hit the same shape of problem:
|
|
386
|
+
|
|
387
|
+
| Framework | Dependency | What broke |
|
|
388
|
+
|---|---|---|
|
|
389
|
+
| jaxley 0.13.0 | JAX ≥ 0.7 | `jnp.clip(a_max=...)` removed |
|
|
390
|
+
| brian2 ≤ 2.9 | NumPy ≥ 2.0 | `ndarray.ptp` removed |
|
|
391
|
+
| cpm 0.25.6 | SciPy ≥ 1.18 | `fmin_l_bfgs_b(disp=...)` removed |
|
|
392
|
+
|
|
393
|
+
Research packages pin loosely and their dependencies remove APIs on a schedule
|
|
394
|
+
the packages do not track. This is not unusual and it is not anyone's fault; it
|
|
395
|
+
is the normal condition of a scientific Python environment, and it is a large
|
|
396
|
+
part of why daftar records `env.*` at all. Each of these would appear in a diff
|
|
397
|
+
as an environment change with a matching result change — or, worse, as code that
|
|
398
|
+
simply stops running.
|
|
399
|
+
|
|
400
|
+
The test suite's rule: **skip for a clash we recognise and can explain, fail
|
|
401
|
+
loudly for anything we do not.** An unrecognised error might be our bug, and a
|
|
402
|
+
silent skip would hide it.
|
|
403
|
+
|
|
404
|
+
---
|
|
405
|
+
|
|
338
406
|
## Adapter tests pass but a manifest field says `<unavailable>`
|
|
339
407
|
|
|
340
408
|
Working as designed, and worth understanding. `adapters/base.py` wraps every
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "daftar"
|
|
7
|
-
version = "0.3.
|
|
7
|
+
version = "0.3.2"
|
|
8
8
|
description = "Record what produced each computational result: environment, code, parameters, seeds, inputs."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.2"
|
|
@@ -53,6 +53,70 @@ def _require(name: str):
|
|
|
53
53
|
return pytest.mark.skipif(True, reason=f"{name} not installed")
|
|
54
54
|
|
|
55
55
|
|
|
56
|
+
def _require_working(name: str, probe, clash_marker: str = "version clash"):
|
|
57
|
+
"""Skip only for a *known* framework/dependency clash; fail on anything else.
|
|
58
|
+
|
|
59
|
+
This is the third instance of the same pattern -- jaxley against JAX,
|
|
60
|
+
brian2 against NumPy, cpm against SciPy -- so it is worth stating the rule
|
|
61
|
+
once. Research packages pin loosely and their dependencies remove APIs, so
|
|
62
|
+
a framework that imports cleanly can still be unusable.
|
|
63
|
+
|
|
64
|
+
The rule: skip when we recognise the clash and can explain it, because it is
|
|
65
|
+
not our bug and the user needs to be told what to do. Fail loudly for
|
|
66
|
+
anything else, because an unrecognised error may well be *our* bug and a
|
|
67
|
+
silent skip would hide it.
|
|
68
|
+
"""
|
|
69
|
+
state, reason = daftar.adapters.get(name).availability()
|
|
70
|
+
if state != daftar.adapters.AVAILABLE:
|
|
71
|
+
return pytest.mark.skipif(True, reason=f"{name}: {reason}")
|
|
72
|
+
ok, why = probe()
|
|
73
|
+
return pytest.mark.skipif(not ok and clash_marker in why, reason=why)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def _cpm_is_usable() -> tuple[bool, str]:
|
|
77
|
+
"""Check that cpm can actually fit before blaming the adapter.
|
|
78
|
+
|
|
79
|
+
cpm 0.25.6 calls ``fmin_l_bfgs_b(..., disp=self.display)``. SciPy deprecated
|
|
80
|
+
``disp`` and ``iprint`` for L-BFGS-B and removed them in 1.18.0, so cpm
|
|
81
|
+
imports fine and then raises ``TypeError`` the moment you fit anything.
|
|
82
|
+
``daftar doctor`` reports cpm as ``ok`` because the import succeeds --
|
|
83
|
+
importing is not the same as working.
|
|
84
|
+
"""
|
|
85
|
+
try:
|
|
86
|
+
import numpy as np
|
|
87
|
+
import pandas as pd
|
|
88
|
+
from cpm.generators import Parameters, Value, Wrapper
|
|
89
|
+
from cpm.optimisation import FminBound, minimise
|
|
90
|
+
|
|
91
|
+
def model(parameters, trial):
|
|
92
|
+
return {"dependent": np.array([trial["stimulus"] * parameters.alpha])}
|
|
93
|
+
|
|
94
|
+
data = pd.DataFrame({
|
|
95
|
+
"ppt": [1, 1, 2, 2],
|
|
96
|
+
"stimulus": [1.0, 2.0, 1.0, 2.0],
|
|
97
|
+
"observed": [0.1, 0.2, 0.15, 0.25],
|
|
98
|
+
})
|
|
99
|
+
params = Parameters(alpha=Value(value=0.1, lower=0.0, upper=1.0,
|
|
100
|
+
prior="norm",
|
|
101
|
+
args={"mean": 0.5, "sd": 0.25}))
|
|
102
|
+
wrapper = Wrapper(model=model, data=data.iloc[:2], parameters=params)
|
|
103
|
+
FminBound(model=wrapper, data=data,
|
|
104
|
+
minimisation=minimise.LogLikelihood.continuous,
|
|
105
|
+
ppt_identifier="ppt", approx_grad=True).optimise()
|
|
106
|
+
return True, ""
|
|
107
|
+
except TypeError as exc:
|
|
108
|
+
if "disp" in str(exc) or "iprint" in str(exc):
|
|
109
|
+
import scipy
|
|
110
|
+
return False, (
|
|
111
|
+
f"cpm/SciPy version clash: this cpm release passes disp= to "
|
|
112
|
+
f"fmin_l_bfgs_b, which SciPy {scipy.__version__} removed in "
|
|
113
|
+
f"1.18.0. Not a daftar bug. Fix with: pip install 'scipy<1.18'"
|
|
114
|
+
)
|
|
115
|
+
return False, f"cpm unusable: {type(exc).__name__}: {exc}"
|
|
116
|
+
except Exception as exc: # pragma: no cover - environment dependent
|
|
117
|
+
return False, f"cpm unusable: {type(exc).__name__}: {exc}"
|
|
118
|
+
|
|
119
|
+
|
|
56
120
|
def _jaxley_is_usable() -> tuple[bool, str]:
|
|
57
121
|
"""Check that Jaxley can integrate at all before blaming the adapter.
|
|
58
122
|
|
|
@@ -183,7 +247,7 @@ def test_jaxley_same_config_reproduces(store):
|
|
|
183
247
|
# cpm
|
|
184
248
|
# ==========================================================================
|
|
185
249
|
|
|
186
|
-
@
|
|
250
|
+
@_require_working("cpm", _cpm_is_usable)
|
|
187
251
|
def test_cpm_records_bounds_priors_and_restarts(store):
|
|
188
252
|
import numpy as np
|
|
189
253
|
import pandas as pd
|
|
@@ -367,9 +431,12 @@ def test_at_least_report_what_is_installed():
|
|
|
367
431
|
except Exception:
|
|
368
432
|
pass
|
|
369
433
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
434
|
+
print("\nruntime checks (importing is not the same as working):")
|
|
435
|
+
for name, probe in (("jaxley", _jaxley_is_usable), ("cpm", _cpm_is_usable)):
|
|
436
|
+
if not daftar.adapters.get(name).is_available():
|
|
437
|
+
continue
|
|
438
|
+
ok, why = probe()
|
|
439
|
+
print(f" {name:<12} {'usable' if ok else 'UNUSABLE -- ' + why}")
|
|
373
440
|
|
|
374
441
|
|
|
375
442
|
# ==========================================================================
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.3.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|