Skip to content

Don't type protocol as ClassVar #1800

Open
@kylebarron

Description

@kylebarron

Protocol is defined as a ClassVar:

protocol: ClassVar[str | tuple[str, ...]] = "abstract"

This means that pylance gives me an error when I try to set it in a constructor:

Image

Typing protocol as a ClassVar makes sense if you assume that you have separate, concrete classes for each implementation, but this is not always true. In Obstore, we have one class (FsspecStore) which dynamically supports different protocols based on the type of obstore.store used inside it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions