Skip to content

SourceDocument: a dataclass saved as one module of assignments - #5

Merged
trissim merged 2 commits into
mainfrom
refactor/E2-source-document
Oct 12, 2026
Merged

trissim merged 2 commits into
mainfrom
refactor/E2-source-document

Conversation

@trissim

@trissim trissim commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Adds pycodify.SourceDocument. A dataclass that inherits it is saved as one Python module: each constructor field (init=True) is one module-level assignment named after the field, in declaration order, and is read back by that name.

  • assignment_names(), from_namespace() (a field with a default may be absent; a required one raises ValueError), from_source(), body(), to_source(header=, clean_mode=).
  • init=False fields are not saved, matching the dataclass formatter.

OpenHCS surface E2 uses it to delete three enums that restated the field names of its pipeline, step and config documents.

No version bump (the owner assigns versions).

Tests: pytest tests 71 passed locally.

🤖 Generated with Claude Code

Each constructor field is one module-level assignment named after the
field; the field declaration is the only place the name is spelled.

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

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.

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