DI restructuring of CellpyCell: injectable core + instrument factory (#520)#528
Merged
jepegit merged 4 commits intoJul 17, 2026
Merged
Conversation
…#518) Verbatim move following the #509 capacity_curves pattern: instance-first functions, thin delegates on CellpyCell keep the public API and subclass dispatch. to_bdf was already thin and stays. The near-dead test-pinned _cap_mod_summary/_cap_mod_normal move along; their removal is deferred to the DI pass (#520). Dropped a stray print(externals) debug line from to_excel; removed the now-unused csv/itertools imports from cellreader. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Verbatim move following the #509 capacity_curves pattern: instance-first functions, thin delegates on CellpyCell keep the public API. The CellpyCell.vacant classmethod is called instance-bound (identical for CellpyCell, dispatches for subclasses). Coverage of the helpers was thin (only split/drop_from/drop_to pinned); added pins for from_cycle, to_cycle, drop_edges (+error cases), split_many with a list, and with_cycles. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…520) Design-first per the issue: ADR in .issueflows/04-designs-and-guides/cellpycell-di-restructuring.md decides what __init__ owns vs receives. The two behavioural collaborators become constructor-injectable with unchanged defaults: - core=: injected core seam wins over the native_schema-flag default - instrument_factory=: injected loader registry; register_instrument_readers() now only builds the default when none is set (idempotent-with-injection instead of silently rebuilding) Config snapshot / units / headers stay owned (plain data, already parameterizable); the extracted modules stay wired as instance-first functions + thin delegates. Two DI pins added to test_slim.py. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Base automatically changed from
refactor/519-extract-slicing
to
feat/511-native-schema-opt-in
July 17, 2026 13:52
jepegit
added a commit
that referenced
this pull request
Jul 17, 2026
) * Fix cellpycore 0.2.2 sync fallout: merger summary test_id + stale tests Core #136 bridges test_id through the legacy steps/summary output, which left four non-essential tests failing on master and exposed a merger bug: campaign_fold concatenated the right-hand summary without remapping its test_id, so a merged (pre-recompute) summary carried test_id=0 on every row and would round-trip wrongly through v9. - merger: remap the right summary's test_id via the merge id-map (mirrors the raw handling) - cellreader: drop the #507 re-stamp workaround in make_step_table (core 0.2.2 delivers test_id directly) - tests: update the .h5 -> .cellpy default-extension expectations and the single-test no-test_id assertion; add a regression test for the merger remap Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Native schema opt-in: CellpyCell(native_schema=True) (#511, V2-11) Feature-flagged path where frames stay in native cellpy-core column names and the polars engine runs directly - no legacy rename sandwich. The legacy bridge stays the default; goldens unchanged. - new NativeCellpyCellCore adapter (pandas <-> polars seam, no renames) accepting the same call signatures cellreader uses against the bridge - one-time translate at the I/O boundary in from_raw / load - guards: v8 HDF5 save and campaign merge raise on native-schema cells - make_summary skips the legacy column sort on the native path - 8 new tests incl. native-vs-legacy value parity through the mapping and a native v9 round-trip - epic status table updated (Phases 1-4 were done but still marked open) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Extract exporter family from cellreader into cellpy.exporters.tabular (#518) (#526) Verbatim move following the #509 capacity_curves pattern: instance-first functions, thin delegates on CellpyCell keep the public API and subclass dispatch. to_bdf was already thin and stays. The near-dead test-pinned _cap_mod_summary/_cap_mod_normal move along; their removal is deferred to the DI pass (#520). Dropped a stray print(externals) debug line from to_excel; removed the now-unused csv/itertools imports from cellreader. Co-authored-by: Claude Fable 5 <noreply@anthropic.com> * Extract split/drop-cycle helpers into cellpy.readers.slicing (#519) (#527) * Extract exporter family from cellreader into cellpy.exporters.tabular (#518) Verbatim move following the #509 capacity_curves pattern: instance-first functions, thin delegates on CellpyCell keep the public API and subclass dispatch. to_bdf was already thin and stays. The near-dead test-pinned _cap_mod_summary/_cap_mod_normal move along; their removal is deferred to the DI pass (#520). Dropped a stray print(externals) debug line from to_excel; removed the now-unused csv/itertools imports from cellreader. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Extract split/drop-cycle helpers into cellpy.readers.slicing (#519) Verbatim move following the #509 capacity_curves pattern: instance-first functions, thin delegates on CellpyCell keep the public API. The CellpyCell.vacant classmethod is called instance-bound (identical for CellpyCell, dispatches for subclasses). Coverage of the helpers was thin (only split/drop_from/drop_to pinned); added pins for from_cycle, to_cycle, drop_edges (+error cases), split_many with a list, and with_cycles. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> * DI restructuring of CellpyCell: injectable core + instrument factory (#520) (#528) * Extract exporter family from cellreader into cellpy.exporters.tabular (#518) Verbatim move following the #509 capacity_curves pattern: instance-first functions, thin delegates on CellpyCell keep the public API and subclass dispatch. to_bdf was already thin and stays. The near-dead test-pinned _cap_mod_summary/_cap_mod_normal move along; their removal is deferred to the DI pass (#520). Dropped a stray print(externals) debug line from to_excel; removed the now-unused csv/itertools imports from cellreader. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Extract split/drop-cycle helpers into cellpy.readers.slicing (#519) Verbatim move following the #509 capacity_curves pattern: instance-first functions, thin delegates on CellpyCell keep the public API. The CellpyCell.vacant classmethod is called instance-bound (identical for CellpyCell, dispatches for subclasses). Coverage of the helpers was thin (only split/drop_from/drop_to pinned); added pins for from_cycle, to_cycle, drop_edges (+error cases), split_many with a list, and with_cycles. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * DI restructuring of CellpyCell: injectable core + instrument factory (#520) Design-first per the issue: ADR in .issueflows/04-designs-and-guides/cellpycell-di-restructuring.md decides what __init__ owns vs receives. The two behavioural collaborators become constructor-injectable with unchanged defaults: - core=: injected core seam wins over the native_schema-flag default - instrument_factory=: injected loader registry; register_instrument_readers() now only builds the default when none is set (idempotent-with-injection instead of silently rebuilding) Config snapshot / units / headers stay owned (plain data, already parameterizable); the extracted modules stay wired as instance-first functions + thin delegates. Two DI pins added to test_slim.py. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The architectural tail of V2-09 (closes #520), design-first as the issue requires: the ADR in
.issueflows/04-designs-and-guides/cellpycell-di-restructuring.mddecides whatCellpyCell.__init__owns vs receives.Stacked on #527 (→ #526 → #525 → #524) — merge in order and retarget.
core=— the injected core seam wins over thenative_schema-flag default; it owns theDataobject and runs the step/summary engine.instrument_factory=— the injected loader registry is used byset_instrument;register_instrument_readers()now builds the default only when none is set (idempotent-with-injection instead of silently discarding an injected factory; it was only ever called from__init__)._cap_mod_*fate question deferred from v2: extract exporter family from cellreader (V2-09 follow-up) #518: keep as moved until a deprecation sweep.Test plan
test_slim.py(core-seam acceptance): 6 → 8 tests, green — including the two new DI pins (injected core drives the pipeline; injected factory is used and never rebuilt)🤖 Generated with Claude Code