Skip to content

Own the JSON encoder, module public surfaces and lazy exports (L2) - #16

Merged
trissim merged 2 commits into
mainfrom
refactor/L2-codec-public-api
Oct 10, 2026
Merged

trissim merged 2 commits into
mainfrom
refactor/L2-codec-public-api

Conversation

@trissim

@trissim trissim commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

OpenHCS consolidation surface L2: python-introspect becomes the one dataclass codec and module-surface helper.

  • to_jsonable (singledispatch encoder: dataclasses by declared fields, mappings, sequences, enums, paths, callables by import identity, AutoRegisterMeta types by registry key) and the JsonValue/JsonObject/JsonScalar aliases move here from openhcs.serialization.json, beside the existing dataclass_from_mapping decoder.
  • declared_public_names, exported_public_names, public_names_from_objects, is_declared_public_name move here from openhcs.core.public_api.
  • New lazy_exports(globals(), {owner_module: names}) installs the PEP 562 __getattr__/__dir__ pair (resolve once, cache in globals, reject a name declared by two owners) and returns the names for __all__. It replaces the verbatim copies in OpenHCS; arraybridge, PolyStore, zmqruntime and pyqt-reactive carry the same copy and can adopt it.
  • Family-level tests: encoder/decoder round trip over every value family, registration of a new value family, public-name derivation, lazy-export resolution and conflicts.
  • Version 0.2.2 (additive; stays inside ObjectState's <0.3 bound).

Lockstep OpenHCS PR follows (deletes the local copies, migrates importers, bumps the submodule and pin). Do not merge before review.

🤖 Generated with Claude Code

to_jsonable becomes the encoder paired with dataclass_from_mapping, moved
from OpenHCS with its JsonValue/JsonObject/JsonScalar aliases. The module
public-surface helpers (declared_public_names and friends) move from
OpenHCS core.public_api. lazy_exports(globals(), {owner: names}) installs
the PEP 562 __getattr__/__dir__ pair that first-party packages copied
verbatim, and returns the exported names for __all__.

Version 0.2.2: additive, within the <0.3 bound ObjectState pins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 10, 2026 02:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

The path assertions now compare against str(PurePath(...)), which matches
the encoder's str(path) on Windows. The changelog records that 0.2.2 is
the first 0.2.x on PyPI (the 0.2.0/0.2.1 publishes were cancelled).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@trissim
trissim merged commit 496fedb into main Oct 10, 2026
12 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