feat(batch)!: cut utils.batch over to the cellpy.batch facade (#703) - #733
Merged
Conversation
Groundwork for the A7 cutover: the new facade needs the db path the legacy init()->create_journal() flow used. - db.py: journal_from_db() wraps the existing db readers (simple Excel + JSON) and converts their pandas pages to the new polars Journal. - facade: Batch.from_db(), deferred-read create_journal() (init stores db config, create_journal performs the read), load(db=...) source. +2 tests (from_db, create_journal-reads-db). Full batch-v3 suite: 43 green.
…703) The A7 cutover: `cellpy.utils.batch` is now a thin shim over `cellpy.batch`. `init`/`load`/`from_journal`/`naked` return the new polars-based `Batch`; `init2`/`from_journal2`/`load_journal`/`load_pages`/`process_batch`/ `iterate_batches` warn once. BREAKING: `b.pages` is polars (keys-in-columns), cells are `b.cells[label]` (not `b.experiment.data[...]`). - facade: `update()` routes unknown legacy kwargs (e.g. `testing`) to the loader; `Batch.experiment` backward-compat adapter keeps helpers/collectors working; `from_db`/deferred `create_journal` for the init->create_journal flow. - journal: db `argument` dict-columns stored as polars Object. - test_batch.py migrated to the new surface (polars pages, `b.cells`, `b.save`); reader + batch_tools-direct tests unchanged. - xfail (re-based by their own redesign): collectors tests (Epic B #706-708), helpers.concat_summaries paths (Epic C #706), batch plot snapshot (Epic B). batch_tools import-warning deferred to E4 (db.py still bridges through it). Full suite green (essential + full). Closes #703. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jepegit
enabled auto-merge (squash)
July 26, 2026 22:06
|
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. |
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.
A7 — the cutover:⚠️ breaking
cellpy.utils.batch→cellpy.batchSeventh arc of Epic A (batch v3, #696).
cellpy.utils.batchis now a thin shim over the newcellpy.batchpackage. The 2232-line legacybatch.pyis replaced by a ~120-line shim (net −1,984 lines).Shim
init/load/from_journal/naked→ return the newcellpy.batch.Batch.init2/from_journal2/load_journal/load_pages/process_batch/iterate_batches→ deprecated wrappers (warn_once);iterate_batches/process_batchbecome docs recipes.DB bridge (prerequisite, first commit)
cellpy/batch/db.pyjournal_from_db()wraps the existing Excel/JSON readers → new polarsJournal;Batch.from_db+ deferredcreate_journal()reproduce the legacyinit()→create_journal()flow.Facade
update()routes unknown legacy kwargs (testing, …) to the loader;Batch.experimentbackward-compat adapter keepshelpers/collectorsworking against the new Batch until they migrate; dbargumentdict-columns stored as polarsObject.b.pagesis polars (keys-in-columns), not pandas — no.iloc/.loc/.index.b.cells[label], notb.experiment.data[label].b.experiment.journal.to_file(...)→b.save(...);force_cellpy/force_raw/force_recalc→LoadPolicy;b.combine_summaries()returns a tidy polars frame.Tests
test_batch.pymigrated to the new surface; reader +batch_tools-direct tests unchanged. Full batch-v3 + batch suites green.test_collectors.py(Epic B B2: collectors — options + pipeline (fixes cross-cell bug) #706-708),helpers.concat_summariespaths (Epic C B2: collectors — options + pipeline (fixes cross-cell bug) #706), batch plot snapshot (Epic B), the summary-collection benchmark.Deferred with reason: the
batch_toolsimport-warning waits for E4 (the newdb.pystill bridges throughbatch_tools). The human-readable symbol map is folded into the G3 migration guide.Closes #703. Part of #696.
🤖 Generated with Claude Code