Skip to content

Make name required; drop labels/location; unexport TimeSeriesTable; add validate_unit#5

Merged
FreaxMATE merged 1 commit intomainfrom
slim
Apr 14, 2026
Merged

Make name required; drop labels/location; unexport TimeSeriesTable; add validate_unit#5
FreaxMATE merged 1 commit intomainfrom
slim

Conversation

@FreaxMATE
Copy link
Copy Markdown
Collaborator

@FreaxMATE FreaxMATE commented Apr 13, 2026

Slim the public surface of TimeSeries and TimeSeriesDescriptor to pure time-series metadata:

  • name is now required on both TimeSeries and TimeSeriesDescriptor (str, no longer Optional[str]). The field already existed and was already called name — this just makes it mandatory.
  • Drop labels and location from TimeSeries, TimeSeriesDescriptor, and TimeSeriesTable. Identity-shaped concepts (labels, tags) and spatial context belong to consumer layers (energydatamodel, energydb), not to time-series metadata itself.
  • Unexport TimeSeriesTable — removed from __init__.py / __all__ and its repr mixin. The class stays in timedatamodel/timeseriestable.py as an internal utility; higher-level packages own the collection abstraction.
  • units.py / validate_unit() — new module with a shared lazy pint.UnitRegistry and a validate_unit() helper. Covered by tests/test_units.py.
  • Example + test overhaulnb_01_timeseries.ipynb, nb_02_timeseriestable.ipynb, and their docs counterparts replaced by a single examples/quickstart.ipynb. tests/test_timeseriestable.py removed.
  • Slim _repr.py — ~95 lines lighter after dropping the TimeSeriesTable repr mixin and location formatting.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors timedatamodel to make time-series “identity” and spatial context consumer-owned, leaving timedatamodel with metric-first, pure metadata and univariate series handling (and removing the multivariate table API).

Changes:

  • Rename name → required metric across TimeSeries and TimeSeriesDescriptor; remove labels and location from both.
  • Remove TimeSeriesTable (and its repr mixin / docs / tests).
  • Add pint-backed validate_unit(unit) and refresh docs/examples/tests; bump version to 0.2.1.

Reviewed changes

Copilot reviewed 23 out of 24 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
uv.lock Update locked local package version to 0.2.1.
timedatamodel/units.py Add validate_unit() helper for pint-backed unit-string validation.
timedatamodel/timeseriestable.py Removed TimeSeriesTable implementation.
timedatamodel/timeseriesdescriptor.py Make descriptor metric-first; remove labels/location; simplify and keep frozen/slots.
timedatamodel/timeseries.py Make metric required; remove labels/location; update descriptor round-trip and metadata helpers.
timedatamodel/_repr.py Remove location/labels from repr; remove table repr mixin; switch “Name” → “Metric”.
timedatamodel/init.py Stop exporting TimeSeriesTable; keep location primitives exported.
tests/test_units.py Add tests for validate_unit() (pint-gated).
tests/test_timeseriestable.py Remove tests for TimeSeriesTable.
tests/test_timeseriesdescriptor.py Update descriptor tests for metric requirement and new field set.
tests/test_timeseries.py Update tests to use required metric and remove label/location expectations.
README.md Update public-facing API narrative/examples to metric-first and remove table mentions.
pyproject.toml Bump project version to 0.2.1.
examples/quickstart.ipynb Add consolidated quickstart notebook demonstrating the new API surface.
examples/nb_01_timeseries.ipynb Remove old notebook (superseded by quickstart).
docs/usage.md Update usage docs to metric-first and remove multivariate table section.
docs/overview.md Update conceptual overview for descriptor/series split; remove table content; adjust geo section.
docs/index.md Update docs landing page feature list for descriptor/units validation and removal of table.
docs/examples/timeseriestable.ipynb Remove table example notebook.
docs/examples/timeseries.ipynb Remove old time series example notebook.
docs/examples/index.md Update examples index text after notebook removals.
docs/conf.py Remove excluded internals that belonged to TimeSeriesTable.
docs/api.md Remove API docs entry for TimeSeriesTable.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread timedatamodel/timeseries.py Outdated
Comment thread docs/examples/index.md Outdated
Comment thread examples/quickstart.ipynb Outdated
Comment thread timedatamodel/units.py Outdated
Comment thread tests/test_units.py
@FreaxMATE FreaxMATE changed the title TimeSeriesDescriptor, metric-first TimeSeries, drop TimeSeriesTable TimeSeriesDescriptor, metric-first TimeSeries Apr 13, 2026
@FreaxMATE FreaxMATE changed the title TimeSeriesDescriptor, metric-first TimeSeries TimeSeries / TimeSeriesDescriptor to name-only metadata Apr 13, 2026
@FreaxMATE FreaxMATE changed the title TimeSeries / TimeSeriesDescriptor to name-only metadata name-only metadata: drop TimeSeriesTable, rename metric → name, add validate_unit Apr 13, 2026
@FreaxMATE FreaxMATE changed the title name-only metadata: drop TimeSeriesTable, rename metric → name, add validate_unit name-only metadata: rename metric → name, add validate_unit Apr 13, 2026
@FreaxMATE FreaxMATE changed the title name-only metadata: rename metric → name, add validate_unit Slim to name-only metadata; unexport TimeSeriesTable; add validate_unit Apr 13, 2026
@FreaxMATE FreaxMATE changed the title Slim to name-only metadata; unexport TimeSeriesTable; add validate_unit Make name required; drop labels/location; unexport TimeSeriesTable; add validate_unit Apr 14, 2026
@FreaxMATE FreaxMATE merged commit d6f93ea into main Apr 14, 2026
3 checks passed
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.

2 participants