Skip to content

E3 (runtime part 2): migrate headers_* resolvers to native (#715) - #745

Merged
jepegit merged 1 commit into
masterfrom
715c-headers-runtime-part2
Jul 27, 2026
Merged

E3 (runtime part 2): migrate headers_* resolvers to native (#715)#745
jepegit merged 1 commit into
masterfrom
715c-headers-runtime-part2

Conversation

@jepegit

@jepegit jepegit commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Epic E, arc E3 — runtime migration, part 2

Second slice of headers_* → schema.*: the assign-to-variable and family-resolver patterns (hdr = c.headers_summary; hdr.<legacy_attr>). Scope stayed small because most hdr_summary/hdr_steps usage is the module-level get_headers_* singleton (not deprecated) — only the functions that shadow with cell.headers_* are the shim.

Migrated

  • utils/helpers.pyselect_summary_based_on_ratecell.schema.steps/cell.schema.summary.
  • readers/capacity_curves.pyget_ocv step lookup → cell.schema.steps.
  • plotting/registry.py — the summary family resolvers use native attr names (charge_capacity_rawcharge_capacity, cumulated_discharge_capacity_losstest_cumulated_discharge_capacity_loss, end_voltage_*potential_end_*).
  • plotting/prepare/summary.py + utils/plotutils.pyhdr = c.schema.summary; downstream attrs renamed to native (cycle_indexcycle_num, data_pointdatapoint_num_last, test_timelast_test_time, datetime"date_time").
  • plotting/context.py — removed the deprecated headers_summary passthrough property (no consumers remain).

Every native name was resolved via the runtime shim, so behaviour is preserved. Verified: test_figure_specs / test_plotutils_headers / test_ocv_relax / test_cv_partition89 passed.

Deferred

exporters/bdf.py keeps the shim for now — its _COLUMN_MAP is keyed by legacy _txt field names via getattr(headers, spec.cellpy_field), so it needs a dedicated map→native migration (a small follow-up). Once bdf.py lands, the shim properties can be removed (the final E3 PR).

Refs #715

Second slice of the headers_* -> schema.* runtime migration: the
assign-to-variable and family-resolver patterns (hdr = c.headers_summary;
hdr.<legacy_attr>). Scoping stayed small because most hdr_summary/hdr_steps
usage is the module-level get_headers_* singleton (not deprecated) -- only the
functions that shadow with cell.headers_* are the shim.

Migrated:
- utils/helpers.py: select_summary_based_on_rate -> cell.schema.steps /
  cell.schema.summary (c_rate/step_type/cycle_num).
- readers/capacity_curves.py: get_ocv step lookup -> cell.schema.steps.
- plotting/registry.py: the summary family resolvers now use native attr names
  (charge_capacity_raw->charge_capacity, cumulated_discharge_capacity_loss->
  test_cumulated_discharge_capacity_loss, end_voltage_*->potential_end_*).
- plotting/prepare/summary.py + utils/plotutils.py: hdr = c.schema.summary,
  downstream attrs renamed to native (cycle_index->cycle_num, data_point->
  datapoint_num_last, test_time->last_test_time, datetime->"date_time").
- plotting/context.py: removed the deprecated headers_summary passthrough
  property (no consumers remain).

All native names resolved via the runtime shim (behaviour-preserving).
Verified: test_figure_specs / test_plotutils_headers / test_ocv_relax /
test_cv_partition -> 89 passed.

Deferred: exporters/bdf.py keeps the shim for now -- its _COLUMN_MAP is keyed
by legacy `_txt` field names via getattr(headers, spec.cellpy_field), so it
needs a dedicated map->native migration (its own follow-up). Once bdf.py lands,
the shim properties can be removed (the final E3 PR).

Refs #715

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@cursor

cursor Bot commented Jul 27, 2026

Copy link
Copy Markdown

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
jepegit enabled auto-merge (squash) July 27, 2026 10:57
@jepegit
jepegit merged commit f057c13 into master Jul 27, 2026
5 of 6 checks passed
@jepegit
jepegit deleted the 715c-headers-runtime-part2 branch July 27, 2026 11:27
jepegit added a commit that referenced this pull request Jul 27, 2026
The per-instance `headers_normal` / `headers_summary` / `headers_step_table`
attributes were a 2.0 deprecation shim (LegacyHeaderShim) mapping legacy
`*_txt` attribute access to native cellpycore column names. The runtime was
migrated off the shim in 2.1 (parts 1-3, #744/#745/#746); this removes the
shim itself on both the native and legacy-bridge paths per the full-removal
decision.

- delete `cellpy/parameters/legacy_header_shim.py` (+ its test)
- drop the shim wiring block from `CellpyCell.__init__` (both branches)
- drop the shim's pending-deprecation seed; regenerate DEPRECATIONS.md
- migrate the remaining `c.headers_*` accesses to `c.schema.raw/steps/summary`
  across tests and the maccor/custom `__main__` demo blocks; legacy-only step
  columns (`info`) become literals, and legacy-singleton usages keep `*_txt`
- rewrite the shim tests in test_cell_schema.py as a shim-removed assertion

`c.schema.raw` / `c.schema.steps` / `c.schema.summary` is the replacement.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant