Port the DB-journal path natively into cellpy.batch (E4 part 1, #716) - #748
Merged
Conversation
`journal_from_db` (backing `Batch.from_db`) delegated the entire database parse to `LabJournal.from_db()` in `utils/batch_tools/batch_journals.py` (~1134 lines) via `batch_tools/engines.py` (~412 lines). That was the last live consumer of `batch_tools/` from the new `cellpy.batch` stack. This reimplements the DB-journal path natively: - new `cellpy/batch/_dbengine.py`: `simple_db_engine` + `_create_pages_dict` + `_query` (from engines.py) and `find_files` / `fix_groups` / `make_unique_groups` / `create_labels` / `create_factory` (from batch_helpers.py), plus `make_db_reader` (the reader construction that was in `LabJournal.__init__`). The db readers themselves (`dbreader`, `json_dbreader`) are unchanged and still own db access. - `cellpy/batch/db.py` orchestrates from_db natively (reader → select_batch → simple_db_engine → polars Journal); no more `LabJournal` import. `batch_tools/` is now unused by production code (only its own tests still reference it directly). Its deletion + test migration follows in part 2. Verified: the full `Batch.from_db` path (simple Excel reader) plus the create_journal/deferred-db flow pass (test_batch_v3_facade.py), and the whole batch suite stays green (test_batch.py, 50 passed). Part of #716. Co-Authored-By: Claude Opus 4.8 <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. |
jepegit
enabled auto-merge (squash)
July 27, 2026 20:13
jepegit
added a commit
that referenced
this pull request
Jul 27, 2026
With the DB-journal path ported natively (part 1, #748), nothing in production imports `cellpy/utils/batch_tools/` any more. Remove it (~4300 lines: the farm/barn Do-er machinery, LabJournal, engines, batch_helpers, exporters, dumpers, analyzers, reporters, sqlite_from_excel_db) and migrate the tests that still referenced it directly: - test_batch.py: repoint `engines.simple_db_engine` / `engines._query` / `batch_helpers.find_files` to `cellpy.batch._dbengine`; import `get_headers_journal` from `cellpy.parameters.internal_settings`; delete the tests bound to the removed machinery (CyclingExperiment, CSVExporter/dumpers, LabJournal-direct construction, the `batch_plotters`-removed probe). - test_batch_helpers_nulldata.py: deleted (tested the removed `batch_helpers.join_summaries` farm/barn path). - test_dbreader.py: drop the skip-only excel->sqlite test (used the removed `sqlite_from_excel_db`). `cellpy.utils.batch` / `cellpy.utils.collectors` stay as permanent re-export shims (they never imported batch_tools). Stale docstring pointers updated. Verified: test_batch.py + test_dbreader.py + test_batch_v3_facade.py = 57 passed, 1 skipped, 5 xfailed; full suite collects (1463 tests, no import errors). Closes #716. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.
Part 1 of E4 (#716): the native DB-journal port. This is the substantive feature work the issue flagged as "a real feature port, comparable to C2, not a mechanical deletion."
Why
cellpy.batch.db.journal_from_db(which backsBatch.from_db) delegated the entire database parse toLabJournal.from_db()inutils/batch_tools/batch_journals.py(~1134 lines), driven bybatch_tools/engines.py(~412 lines). That was the last live consumer ofbatch_tools/from the newcellpy.batchstack — sobatch_tools/could not be deleted until the DB-journal path was reimplemented natively.What
cellpy/batch/_dbengine.py— native port of the piecesfrom_dbactually needs:simple_db_engine+_create_pages_dict+_query(fromengines.py)find_files/fix_groups/make_unique_groups/create_labels/create_factory(frombatch_helpers.py)make_db_reader— the reader construction that lived inLabJournal.__init__cellpy.readers.dbreader,cellpy.readers.json_dbreader) are unchanged and still own db access.cellpy/batch/db.py— orchestratesfrom_dbnatively (reader →select_batch→simple_db_engine→ polarsJournal); no moreLabJournalimport.After this,
batch_tools/is unused by production code — only its own tests still reference it directly.Verification
test_batch_v3_facade.py— the fullBatch.from_db("simple_excel_reader")path and the deferred-_dbcreate_journal()flow both pass (9 passed).test_batch.py+ facade + helpers = 50 passed, 1 skipped, 5 xfailed.Follow-up (part 2)
Delete
cellpy/utils/batch_tools/and migrate the 3 tests that still import it directly (test_batch.py,test_batch_helpers_nulldata.py,test_dbreader.py), keepingcellpy.utils.batch/cellpy.utils.collectorsas re-export shims. That PR will close #716.Part of #716.
🤖 Generated with Claude Code