PyLance does not appreciate @serializable.serializable_class
- Dominant language
- Python
- Stars
- 7
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
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
Research direction
No files or tests are identified. Start by reproducing the report with PyLance against a class using @serializable.serializable_class, then inspect the decorator's typing behavior and the casting example. Done requires an agreed way for decorated classes to retain usable type information, with verification in the CycloneDX-Python-Lib use case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100