Skip to content

Clean module naming: numpy_impl/ + topic names (#34) - #56

Merged
neuromechanist merged 2 commits into
mainfrom
34-epic-clean-module-naming-and-structure-drop-amica_pyamica_torch_v2-sprawl
Jul 7, 2026
Merged

neuromechanist merged 2 commits into
mainfrom
34-epic-clean-module-naming-and-structure-drop-amica_pyamica_torch_v2-sprawl

Conversation

@neuromechanist

Copy link
Copy Markdown
Member

Closes #34 (epic delivered as a single PR per maintainer decision).

Drops the amica_/pyAMICA/_torch_ng module-name sprawl for topic-based names. Pure structural rename — no behavior change.

Changes

  • NumPy reference → pyAMICA/numpy_impl/: pyAMICA.py→core.py, amica_newton.py→newton.py, amica_pdf.py→pdf.py, amica_data.py→data.py, amica_load.py→load.py, amica_viz.py→viz.py, amica_utils.py→utils.py, amica_cli.py→cli.py; new numpy_impl/__init__.py exposes AMICA. params.json moved alongside its loader (numpy_impl/core.py).
  • PyTorch: torch_impl/amica_torch_ng.py → torch_impl/core.py.
  • Public import surface unchanged: from pyAMICA import AMICA, AMICA_NumPy, AMICATorchNG (plus the numpy_impl/torch_impl subpackages). No compat shims — every call site, test, the CLI entrypoint (python -m pyAMICA.numpy_impl.cli), and the live docs (AGENTS/README/MIGRATION/PROGRESS) were updated directly.
  • Packaging fix (latent bug): pyproject.toml now lists the subpackages explicitly and ships numpy_impl/params.json as package-data. A bare packages=["pyAMICA"] dropped torch_impl/ (and params.json) from the built wheel on some setuptools versions, so a pip-installed import pyAMICA / AMICA_NumPy() would have failed; both now work from a clean wheel install.

Layout decision

numpy_impl/ subpackage (symmetric with torch_impl/), per maintainer choice.

Tests / verification

  • pytest -m "not slow": 85 passed, 5 skipped, 1 xfailed (matches CI exactly). All moves preserved as git renames.
  • Wheel builds and a clean-venv import pyAMICA + AMICA_NumPy() succeed (with numpy_impl + torch_impl + params.json present).
  • Public API round-trips: AMICA_NumPy is numpy_impl.core.AMICA, AMICATorchNG is torch_impl.core.AMICATorchNG. ruff clean.
  • .context/ ADRs and issue notes are archival (point-in-time records) and intentionally left referencing the old paths.

Drop the amica_/pyAMICA/_torch_ng module-name sprawl for topic-based names.

- NumPy reference: pyAMICA.py + amica_*.py -> pyAMICA/numpy_impl/ as
  core/newton/pdf/data/load/viz/utils/cli.py (+ __init__ exposing AMICA).
  params.json moved alongside its loader (numpy_impl/core.py).
- PyTorch: torch_impl/amica_torch_ng.py -> torch_impl/core.py.
- Public import surface unchanged: from pyAMICA import AMICA, AMICA_NumPy,
  AMICATorchNG (plus the numpy_impl/torch_impl subpackages). No compat shims;
  all call sites, tests, CLI (-m pyAMICA.numpy_impl.cli), and docs updated.
- pyproject: list subpackages explicitly and ship numpy_impl/params.json as
  package-data, fixing a latent bug where a bare packages=["pyAMICA"] dropped
  torch_impl/ (and params.json) from the built wheel on some setuptools
  versions -- AMICA_NumPy() now loads its defaults from a clean wheel install.

Tested: pytest -m "not slow" 85 passed / 5 skipped / 1 xfailed (CI-equivalent);
wheel builds and imports (incl. numpy_impl + torch_impl + params.json) from a
clean venv; ruff clean.
@neuromechanist

Copy link
Copy Markdown
Member Author

Review response (code-reviewer, Sonnet)

No critical or important findings. The reviewer verified completeness by grep + built and installed the wheel, imported the public API from it, ran python -m pyAMICA.numpy_impl.cli end-to-end on real EEG, and confirmed 0 content changes beyond import-path rewrites.

  • Fixed the one sub-80 nitpick: README's "File Structure" now lists numpy_impl/params.json (and adds torch_impl/core.py / numpy_impl/core.py) instead of a bare params.json.
  • .context/scratch_history.md's old python -m pyAMICA.amica_cli line is left as-is — it's an archival debugging log, not runnable docs (consistent with leaving .context/ ADRs/issue notes untouched).

@neuromechanist
neuromechanist merged commit 4c4f064 into main Jul 7, 2026
5 checks passed
@neuromechanist
neuromechanist deleted the 34-epic-clean-module-naming-and-structure-drop-amica_pyamica_torch_v2-sprawl branch July 7, 2026 14:16
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.

Epic: Clean module naming and structure (drop amica_/pyAMICA/_torch/_v2 sprawl)

1 participant