Skip to content

feat: Importable types#603

Open
kylebarron wants to merge 8 commits intomainfrom
kyle/importable-types
Open

feat: Importable types#603
kylebarron wants to merge 8 commits intomainfrom
kyle/importable-types

Conversation

@kylebarron
Copy link
Member

@kylebarron kylebarron commented Jan 19, 2026

  • Some types are easier to convert into literal Python objects than others.
    • TypedDicts are fully structural, and so those can be easily put into pure-Python code
    • Classes are not structural. If we export literal classes, then users may try to use isinstance on them for nominal typing. Instead, we can either export the literal classes from Rust or export just the protocol definitions for those classes. This PR chooses the latter.
    • We can't define as a protocol anything that the user might try to construct. E.g. we can't define Bytes as a protocol because the user (or at least us in tests) tries to construct Bytes(b"hello world").
  • I still haven't gotten the paths correct for exporting store type information. That's hard because of how we rewrite exports for usability.
  • Is it better to have a mix of some types that are importable and some that are not? Or have all types

All in all, it's hard to know whether this increase in complexity is worth it.

Closes #599

@github-actions github-actions bot added the feat label Jan 19, 2026
@kylebarron
Copy link
Member Author

It looks like we can't have generic typed dicts on Python 3.10 either. See https://github.com/developmentseed/obstore/actions/runs/21149063619/job/60821075855?pr=603 and https://chatgpt.com/share/696e846c-cac8-8008-823e-a42290bc2e17 for reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose config schemas (TypedDict) at runtime

1 participant