static-frame
static-frame copied to clipboard
Pull TypeClinic out into its own package?
The new TypeClinic is pretty cool. I'm wondering if it (c|sh)ouldn't be pulled out into its own package? I've found it useful for validating, for example, generically typed attrs
class fields:
import attrs
import static_frame as sf
@attrs.frozen
class X:
x: list[int] = attrs.field()
inst = X(
x=[1.0, 2], # no run-time error here.
)
field_attribute = attrs.fields_dict(X)["x"]
tc = sf.TypeClinic(inst.x)
tc.check(field_attribute.type)
# static_frame.core.type_clinic.ClinicError:
# In list[int]
# └── Expected int, provided float invalid
Thank you! I had a similar thought. If there is broad interest in doing so I would certainly consider that.