Skip to content

py/scalar: consolidation and code-size reduction - #94

Merged
haydnv merged 14 commits into
mainfrom
pr/scalar-consolidation
Jul 29, 2026
Merged

py/scalar: consolidation and code-size reduction#94
haydnv merged 14 commits into
mainfrom
pr/scalar-consolidation

Conversation

@haydnv

@haydnv haydnv commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

This PR is a broad Python client simplification and ergonomics pass focused on one goal: make URI/state/ref construction follow a single obvious path and remove legacy/transitional indirection.

What changed

  • Moved fully to direct URI(...) construction and removed URI.of(...) usage across runtime/tests.
  • Simplified URI handling rules:
    • keep URI typed in domain logic,
    • convert to string only at wire boundaries (JSON keys, HTTP/kernel paths).
  • Added URI.with_authority(...) and used it to remove repeated authority-rewrite boilerplate.
  • Removed redundant URI patterns like URI(path=URI(...)) and tc.URI(path=tc.URI(...)).
  • Made symbolic boxing state-generic:
    • autobox now accepts object/Any and returns State,
    • preserves non-scalar State values,
    • supports numpy-native tensor boxing to Tensor.
  • Continued scalar/state hierarchy cleanup:
    • reduced helper duplication,
    • simplified op/ref path composition,
    • removed unnecessary compatibility-style branching.
  • Refactored opref/executor path flow:
    • oprefs normalize path via str(...),
    • removed extra path/body indirection in executor.
  • Consolidated tensor dtype URI handling and fixed canonical numeric dtype paths expected by local backend.
  • Added/updated style guards to prevent regressions:
    • ban URI(...).path constructor extraction,
    • ban redundant str(URI(<already URI>)) wrapping,
    • ban URI.parse(str(...)) churn outside uri.py.
  • Updated tests throughout to reflect the new canonical URI + symbolic behavior.

Result

  • Cleaner and smaller symbolic/runtime surface.
  • More consistent URI ergonomics.
  • Fewer transitional helpers and less repetitive code.
  • Full test suite passes: 525 passed, 4 skipped.

@code-tc
code-tc changed the base branch from pr/opref-hierarchy to main July 27, 2026 08:28
Comment thread py/tinychain/collection/tensor/core.py Outdated
Comment thread py/tinychain/uri.py
haydnv added 14 commits July 29, 2026 12:42
- remove legacy scalar/ref path aliases and obsolete compatibility fallbacks
- standardize URI/path naming (*_URI, *_PATH) across state/scalar refs/opdefs
- remove TCRef.id + coerce-style naming and dead _cmp_key helpers
- centralize context resolution and ban try-import antipatterns
- add lint/design rules to lock in canonical symbolic construction style
@haydnv
haydnv force-pushed the pr/scalar-consolidation branch from 79bddee to db73341 Compare July 29, 2026 07:20
@haydnv
haydnv merged commit f1460ad into main Jul 29, 2026
@haydnv
haydnv deleted the pr/scalar-consolidation branch July 29, 2026 12:15
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