Skip to content

Retire blob_type #128

@rwb27

Description

@rwb27

blob_type exists as a shorthand to create subclasses of Blob with the media type pre-filled. However, it doesn't play nicely with type checking/annotations, because types should not be the result of function calls.

I propose we remove blob_type and instead explain that Blob subclasses should be made by subclassing, e.g.

class PNGBlob(Blob):
    media_type: str = "image/png"

This is two lines rather than one, but it works properly with all the tools I've tried (mostly VSCode and mypy).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions