-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REF: move registry, Registry to dtypes.base #34830
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
no objections from me - @TomAugspurger thoughts? |
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.
Yeah, sounds reasonable. Light suggestion to move it to it's own module to avoid moving things twice, but either way works. Merge whenever.
@@ -352,3 +352,92 @@ def _get_common_dtype(self, dtypes: List[DtypeObj]) -> Optional[DtypeObj]: | |||
return self | |||
else: | |||
return None | |||
|
|||
|
|||
def register_extension_dtype(cls: Type[ExtensionDtype]) -> Type[ExtensionDtype]: |
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.
Perhaps even their own file?
Right now it might not merit its own file, but in the future I could see us having an entrypoints-based registry, which will add more lines.
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.
yeah i agree, let's create registry.py
Hmm doctests failure may be related though. |
I see how the doctest is failing, but its not at all clear why it isnt failing in master |
I couldn't seem to reproduce that error locally. Looks like the assertion was added back in #30619 to close a mypy issue - @simonjayhawkins any idea? |
@@ -352,3 +352,92 @@ def _get_common_dtype(self, dtypes: List[DtypeObj]) -> Optional[DtypeObj]: | |||
return self | |||
else: | |||
return None | |||
|
|||
|
|||
def register_extension_dtype(cls: Type[ExtensionDtype]) -> Type[ExtensionDtype]: |
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.
yeah i agree, let's create registry.py
hmm not sure about this, since the other two funcs im interested in (pandas_dtype and is_dtype_equal) depend on registry, so not sure where those would go. but its a moot point until i figure out the doctest thing, which im getting nowhere on |
I think the comments in #30619 explain the reasoning. Could either sort out the class hierarchy so that Liskov is obeyed (maybe add something like a _basename class attribute to access from the construct_from_string classmethod) or simply change the assert to a cast or #type: ignore for now. |
This reverts commit 3125430.
lgtm ping on green |
ping |
These are more closely related to ExtensionDtype than to our internal EADtypes. More concretely, they are low-dependency, while dtypes.dtypes has some unfortunate circular dependencies.
I'd also like to move pandas_dtype and is_dtype_equal from dtypes.common so that those can be stricty "above" dtypes.dtypes in the dependency structure. Saving that for another pass.