Skip to content

refactor(nest): split _nest into category packages; promote _validation/_network; relocate internal docs#84

Merged
chaoming0625 merged 5 commits into
mainfrom
worktree-refactor+nest-package-split
Jun 16, 2026
Merged

refactor(nest): split _nest into category packages; promote _validation/_network; relocate internal docs#84
chaoming0625 merged 5 commits into
mainfrom
worktree-refactor+nest-package-split

Conversation

@chaoming0625

Copy link
Copy Markdown
Contributor

Summary

Large structural refactor of the brainpy_state package. No public API change — the brainpy_state / brainpy.state surface is byte-for-byte identical (__all__ = 210 names, every name resolves).

Package split & promotion

  • brainpy_state/_nest/ → split by NEST model type into:
    • _nest_base (marker base classes + _utils/_plastic_base)
    • _nest_neuron, _nest_synapse, _nest_plasticity, _nest_device
  • _nest/_validation/ → promoted to top-level _nest_validation
  • _network/ → renamed _nest_network

All intra-package, absolute, and root re-export imports rewritten to the new locations. File history is preserved (git rename detection).

Marker wiring (pre-move)

  • 21 previously-unwired synapse/plasticity spec classes now subclass their NEST marker base: STP + static synapses → NESTSynapse; STDP + voltage-based rules → NESTPlasticity.

Docs & examples

  • examples/nest/examples/nest_like/ (and ~80 coupled test imports updated: dotted examples.nest, slash paths, and a pathlib segment).
  • Internal working docs relocated out of the published tree into develop/:
    • CONTEXT.mddevelop/NEST_PARITY_LEDGER.md
    • DESIGN_delays_and_missing_features.mddevelop/
    • docs/nest-status/internal/develop/nest-status/internal/
  • Fixed the nest-base.rst class-tree annotation and the network-api.md spike_recorder import path.

Verification

  • import brainpy_state OK; __all__ byte-for-byte identical (210 names).
  • find_packages auto-discovers all new packages (no pyproject change needed).
  • Collection: 2767 tests (matches pre-refactor baseline), 0 import errors.
  • Full non-NEST suite: 2759 passed, 9 skipped, 0 failed (one off-by-one path-depth bug introduced by the _validation promotion was found and fixed).
  • Functional + published surfaces (brainpy_state/, examples/, docs/) carry zero stale path references.

Notes

  • Historical changelog.md entries and the relocated develop/ internal scratch docs intentionally retain old-path mentions (historical record / internal notes).

🤖 Generated with Claude Code

Chaoming Wang added 5 commits June 16, 2026 22:09
…ticity markers

Add the appropriate NEST marker base class and a super().__init__(in_size=1)
prologue to the 21 previously-unwired synapse/plasticity spec classes, mirroring
the existing gap_junction(NESTSynapse) precedent. Short-term-plasticity specs
(tsodyks*, quantal_stp) and static synapses are NESTSynapse; STDP and
voltage-based rules are NESTPlasticity. Rule kernels and NEST parameter
semantics are unchanged. _base.py taxonomy docstrings updated to match.
…on/_network

Split the flat brainpy_state/_nest package into five focused packages and
promote two subpackages to top level:

- _nest             -> _nest_base, _nest_neuron, _nest_synapse,
                       _nest_plasticity, _nest_device  (by NEST model type)
- _nest/_validation -> _nest_validation
- _network          -> _nest_network

All intra-package, absolute, and root re-export imports are rewritten to the
new locations. The public brainpy_state / brainpy.state surface is unchanged:
__all__ is byte-for-byte identical (210 names) and every name resolves.

Example scripts that import package internals (gap_junction, hh_psc_alpha_gap,
_clopath_drive, SynapseCollection) are updated to the new paths.

Collection: 2767 tests, 0 errors.
…alidation promotion

`_validation` moved from brainpy_state/_nest/_validation (depth 3 under the repo
root) to brainpy_state/_nest_validation (depth 2), so the parents[3] walk to the
repo root overshot into .claude/worktrees. Use parents[2].
…xamples/nest_like

Moves:
- examples/nest/                        -> examples/nest_like/
- CONTEXT.md                            -> develop/NEST_PARITY_LEDGER.md
- DESIGN_delays_and_missing_features.md -> develop/
- docs/nest-status/internal/            -> develop/nest-status/internal/

Update all textual and import references: dotted `examples.nest` imports
(~80 test modules), slash `examples/nest` paths, the brunel_siegert pathlib
segment, and the moved-doc paths. Fix the nest-base.rst class-tree annotation
(_nest/_base.py -> _nest_base/_base.py).

Collection unchanged at 2767 tests; example-coupled tests pass.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, we are unable to review this pull request

The GitHub API does not allow us to fetch diffs exceeding 300 files, and this pull request has 562

@chaoming0625 chaoming0625 merged commit 9e1a904 into main Jun 16, 2026
3 of 5 checks passed
@github-actions

Copy link
Copy Markdown

🎉 Congratulations on opening your first pull request in brainpy.state! Thank you for your contribution!

A maintainer will review your changes soon. Please make sure:

  • ✅ Your code follows our style guidelines
  • ✅ All tests pass
  • ✅ Documentation is updated (if applicable)
  • ✅ You've filled out the PR template completely

We appreciate your effort in making brainpy.state better. If you have any questions, feel free to ask in the comments.

Welcome to the brainpy.state community! 🌟

@github-actions github-actions Bot added documentation Improvements or additions to documentation tests examples labels Jun 16, 2026
@chaoming0625 chaoming0625 deleted the worktree-refactor+nest-package-split branch June 16, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation examples tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant