-
-
Notifications
You must be signed in to change notification settings - Fork 119
Add new strategy register_extra_types #645
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
… circular import from cattrs.fns (type-annotated function will be added there)
@Tinche sorry for the long delay, had to complete some work. Could you please take a look at this draft? It must have flaws, so please feel free to suggest or make any changes. I added a couple of tests, but probably missed some important test cases. It is a pleasure to work on cattrs codebase :) |
My baby's sleep regression is kicking my ass so I'm also going to ask for some patience 😇 From what I understand, the api is supposed to be Doesn't require an import, gets auto complete, a little more discoverable? |
Thank you for finding time for this feature! I wish health and strength to you and your family. For the API design, I was keeping in mind future extensibility with user plugins, so that I use If you are still confident that kwarg-based approach is better, I have no objections to follow this direction until |
Contribution to #641.
Converters supported:
BaseConverter
,Converter
, all preconfigured convertersExtra types added:
complex
uuid.UUID
zoneinfo.ZoneInfo
More extra types to be added in this pull request:
array.array
datetime
:date
,datetime
(not supported by rawBaseConverter
andConverter
)datetime
:time
,timedelta
decimal.Decimal
fraction.Fraction
ipaddress
: ...numbers
:Complex
,Real
,Rational
,Integral
numpy
: ...pathlib.Path
re.Pattern