Skip to content

apischema as a non-optional requirement? #91

@klauer

Description

@klauer

I'm considering making apischema a non-optional requirement.
For those that are unaware, it's what allows blark to easily (de)serialize parsed code to/from JSON directly from the blark.transform dataclasses.
It's currently made optional through a bit of hackery:

blark/blark/transform.py

Lines 26 to 36 in abce326

try:
# NOTE: apischema is an optional requirement; this should work regardless.
import apischema
from .apischema_compat import as_tagged_union
except ImportError:
apischema = None
def as_tagged_union(cls: Type[T]) -> Type[T]:
"""No-operation stand-in for when apischema is not available."""
return cls

It's a reasonably light dependency, and it'd make things more convenient were it just a hard requirement.

Any thoughts, objections, emojis?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions