-
-
Notifications
You must be signed in to change notification settings - Fork 400
Expose effective class construction properties #1454
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
Conversation
2541864
to
af0f118
Compare
470e2eb
to
1edde23
Compare
9575cf9
to
da90471
Compare
@Tinche what did we agree to call the inspect function that extracts the props? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. But where's inspect
? :D
Unfortunately, I'm apparently too dumb to make this work with Mypy. So unless someone can help here, I'll just make it private and ship it. The refactoring are worth it on their own. |
Some more hours wasted later, I got it working by using our internal stuff to create classes and not using enums in the type hints. It seems like any type of type hint triggers Mypy to look at our code which ends in disaster. This also means there's probably no gradual way to make the code base fully typed. :( please final review and merge @Tinche – 25.4.0 will follow ASAP please also look at https://attrs--1454.org.readthedocs.build/en/1454/api.html#attrs.inspect |
(I have changed some of the field names to make them more idiomatic – super open for better ones) |
Mostly to prevent Mypy from looking at our code, but sadly it wasn't enough courtesy of enums for some reason.
To make it clearer these are derived values and nothing you can pass into define/attr.s
_funcs is terribly generic too
ref #602
This is for now just private and the impact zone is limited. But I'm confident it can help us to simplify a bunch of code.
I'm especially rather unhappy with the weird entanglement of _ClassBuilder that doesn't really have a clear purpose (anymore?).
But let's talk in general first!