Skip to content

Preparing for PyPI - #8

Merged
config-i1 merged 7 commits into
mainfrom
python
Jun 20, 2026
Merged

Preparing for PyPI#8
config-i1 merged 7 commits into
mainfrom
python

Conversation

@config-i1

Copy link
Copy Markdown
Collaborator

No description provided.

config-i1 and others added 7 commits June 19, 2026 13:25
The screen's guard `if (any(!is.finite(yv)) || any(yv <= 0)) return(1)`
treated NA/NaN (missing data) as disqualifying, so ANY gap forced
lambda = 1 -- e.g. pts(AirPassengers-with-NA, "ZZZ") gave PTS(1,N,N)
instead of the log fit PTS(0,L,T).

But NA is not a Box-Cox domain problem (only non-positive values are), and
the rest of the screen is already NA-safe: msdecompose imputes the gaps and
the block statistics use na.rm / nan-aware reductions.  Disqualify only on
non-positive *finite* values now (filter to finite first -- `NA <= 0` is NA,
which would error inside `if`).  Applied identically in R
(.pts_guerrero_decomp_lambda) and Python (guerrero_decomp_lambda).

Verified: the NA series now screens to lambda ~= 4.84e-5 (log), matching the
gap-free series, in both languages.

Tests added:
- R tests/testthat/test_stress.R: NA-injected AirPassengers screens to the
  same lambda as the clean series (not collapsed to 1).
- Python tests/test_functionality.py: NaN-injected multiplicative series
  keeps the screen's lambda (smooth-guarded).

R golden master unchanged (the NA path was uncovered before); full R suite,
Python functionality suite, ruff and mypy all green.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
New ZZZ_na spec: AirPassengers with NA at positions 41-43 (matched 0-based
in Python), confirming R<->Python agree on the full output for a gapped
series -- lambda, model, coef, logLik, ICs, nobs, nParam, sigma, and
fitted/residuals (NaN at the 3 missing positions agreeing).  Matches to
2.6e-9, so msdecompose imputation + the engine's NA handling line up across
the two front-ends.

Test plumbing:
- dump_pts_reference.R: per-spec NA injection; na = "null" so NA serialises
  to JSON null.
- test_pts_parity.py: NA_POS applies the gaps to the data; _to_float_array
  maps null/"NA" -> nan; vdiff compares fitted/residuals NaN-aware over the
  common length.

The common-length comparison also absorbs a separate, pre-existing quirk:
R's fitted/residuals occasionally carry one extra trailing element across
sessions (a latent comp/fitted off-by-one in the R engine; Python is always
nobs-long).  Flagged for separate investigation -- it does not affect the
values.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The 145-vs-144 fitted/residuals "nondeterminism" was a harness bug, not
an engine bug: dump_pts_reference.R used sp$na, which partial-matches the
list's "name" element for specs with no na field. That made the NA branch
run as yi[<model-string>] <- NA, appending a named NA and growing the
series 144->145. Use exact [["na"]]. The engine and pts() were always
deterministic at 144; drop the ±1-length tolerance from vdiff accordingly.

Also fix the verbose=TRUE footnote: '*' marks lambda held fixed (not
jointly estimated), not "snapped to a fixed anchor" -- snapping no longer
occurs in the normal R-side-screen flow.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The python-check job recompiled the Armadillo-heavy C++ engine from
scratch every run. scikit-build-core uses a fresh build dir, so CMake's
incremental build can't persist -- but ccache caches at the object level
and survives across runs. Add hendrikmuhs/ccache-action and route the
build through it via cmake.define.CMAKE_CXX_COMPILER_LAUNCHER=ccache.
Also enable setup-python's pip cache keyed on pyproject.toml.

(R-CMD-check already caches its library via setup-r-dependencies.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Distribution name only; the import name stays `muse`
(wheel.packages = ["src/muse"]). Updates pyproject, README install
instructions, and the release/wheel workflows (Trusted Publishing
project + environment URL).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
cibuildwheel's CIBW_BEFORE_ALL_MACOS does `brew install armadillo`, but
Homebrew installs headers under its own prefix (/opt/homebrew on Apple
Silicon, /usr/local on Intel), which Clang does not search by default --
so the compile failed with "'armadillo' file not found". Linux worked
only because libarmadillo-dev lands in /usr/include.

Add an APPLE-only block to CMakeLists that queries `brew --prefix` (with
/opt/homebrew and /usr/local fallbacks) and adds <prefix>/include when the
Armadillo header is present. BLAS/LAPACK still resolve via Accelerate.
Fix is self-contained in CMake, so local Mac builds work too.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@config-i1
config-i1 merged commit acb4499 into main Jun 20, 2026
5 checks passed
config-i1 added a commit that referenced this pull request Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant