Skip to content

ENH: generate Document union type - #364

Merged
evvaaaa merged 3 commits into
bluesky:mainfrom
jacopoabramo:document-type-hint
Aug 28, 2025
Merged

evvaaaa merged 3 commits into
bluesky:mainfrom
jacopoabramo:document-type-hint

Conversation

@jacopoabramo

Copy link
Copy Markdown
Contributor

Description

Add a Document union type; differently from DocumentType, this type union is for type checking instances of document objects rather than their class type.

I simply reshuffled a bit the GENERATED_INIT_PY template to keep the original DocumentType intact.

Motivation and Context

I was trying to type hinting a callback function that should accept all possible documents and realized that DocumentType wasn't fit for the purpose.

How Has This Been Tested?

Tested locally via pytest.

@evvaaaa evvaaaa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

After that looks good to merge.

Comment thread src/event_model/documents/__init__.py Resolved

@evvaaaa evvaaaa left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Squash and merge!

@evvaaaa

evvaaaa commented Aug 28, 2025

Copy link
Copy Markdown
Collaborator

Will merge as we're getting duplicates #365

@evvaaaa
evvaaaa merged commit e312d65 into bluesky:main Aug 28, 2025
@jacopoabramo
jacopoabramo deleted the document-type-hint branch January 14, 2026 16:02
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