Tin Tvrtković
Tin Tvrtković
Hm, what you're really asking for is runtime validation of types in `__init__`, right? Maybe a way for a cattrs converter to wrap `__init__` and apply checks?
We don't support `os.PathLike`, no one has asked for it yet. `pathlib.Path` is supported though. When generating the unstructuring code, cattrs looks at the type of the field in the...
I can consider it, but what's the use case? Either cattrs raises something or your json lib raises something, feels like it ends up being the same?
You're mixing attrs validators and cattrs here. It's not a mistake or anything, but you should be aware attrs validators don't aggregate all errors; they short-circuit on the first one....
It's coming in 24.1, I think in 3-6 months. Sorry :/
I was OK with keeping this open and marked as an enhancement request until we implement this validation, up to you.
Howdy, I don't have any immediate plans for this, but you can try something like the following: ```python import attrs import cattrs c = cattrs.Converter() def validate_int(i): if not isinstance(i,...
I agree, but we should go even further: both union strategies should support `None`, literals and enums in addition to attrs classes, to enable proper sum type handling. However it's...
Hi, so about advice on how to get rid of `#type: ignores`, unfortunately the Python type system doesn't have good support for this kind of metaprogramming yet. Now, as for...
Interesting. So what I think is happening is the hook for `Derived` gets created before the `include_subclasses` hook for `A` gets installed, hence your behavior. It's somewhat of a chicken...