madpah/serializable

PyLance does not appreciate @serializable.serializable_class

Open

#8 opened on Jun 15, 2023

View on GitHub
 (3 comments) (1 reaction) (0 assignees)Python (5 forks)auto 404
help wanted

Repository metrics

Stars
 (7 stars)
PR merge metrics
 (PR metrics pending)

Description

Inadvertantly opened this ticket half way through writing the subject.

PyLance thinks that serializable.serializable_class decorated classes are untyped. I'm unsure if there is a proper way to resolve type based issues. The "fix" seems to be to have one undecorated class and one decorated class that references the former: i.e. "MyThing" and "SerializableMyThing" in order to allow for casting in individual programs.

Looking forward to some insight on this. CycloneDX-Python-Lib makes use of this library and it can be a bit cumbersome to work with classes provided by that library. Attempting to cast falls into the same trap.

Contributor guide