Skip to content
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

Feature proposal: Expose CachingProtocolMeta #15

Closed
antonagestam opened this issue Jul 6, 2022 · 4 comments · Fixed by #17
Closed

Feature proposal: Expose CachingProtocolMeta #15

antonagestam opened this issue Jul 6, 2022 · 4 comments · Fixed by #17

Comments

@antonagestam
Copy link

Hi posita 👋

I'm about to start using CachingProtocolMeta in phantom-types, to define narrower parameter types for comparison et cetera. Would you be willing to consider a PR that exposes (with __all__) and documents CachingProtocolMeta?

@posita
Copy link
Collaborator

posita commented Jul 6, 2022

Meaning so that you can do this …

from numerary import CachingProtocolMeta

… instead of this …

from numerary.types import CachingProtocolMeta

… ?

@antonagestam
Copy link
Author

@posita I actually meant so that I can do:

from numerary.types import CachingProtocolMeta

... without a type error. Because that name isn't in __all__, mypy rightfully considers it private, see the ignore comment here for reference: https://github.com/antonagestam/phantom-types/blob/599db5affb249b691e6dd79bfb7a25af00888579/src/phantom/_utils/types.py#L3.

The specific import path isn't important to me 🙂

@posita
Copy link
Collaborator

posita commented Jul 6, 2022

Ah! Brilliant! My guess is that this stems from the fact that it's defined in _protocol (note the underscore prefix). One option is to rename numerary._protocol to numerary.protocol and then one could do …

from numerary.protocol import CachingProtocolMeta

Yet another option is to move CachingProtocolMeta into numerary.types and delete _protocol.py altogether. I'm not particularly opinionated either way. Feel free to go with whatever aesthetic brings you the most joy. In addition to refactoring any code, I think the only other spot to change would be where and how it appears in the docs.

@antonagestam
Copy link
Author

Cool, great knowing there's a way forward here. I'm on vacation now but might be able to find time addressing this later this summer. Thanks for the feedback! 🙏

posita added a commit that referenced this issue Jul 8, 2022
posita added a commit that referenced this issue Jul 18, 2022
posita added a commit that referenced this issue Jul 19, 2022
posita added a commit that referenced this issue Oct 12, 2022
posita added a commit that referenced this issue Oct 12, 2022
posita added a commit that referenced this issue Oct 12, 2022
posita added a commit that referenced this issue Oct 13, 2022
posita added a commit that referenced this issue Oct 13, 2022
* Migrates from [``setuptools_scm``](https://pypi.org/project/setuptools-scm/) to [``versioningit``](https://pypi.org/project/versioningit/) for more flexible version number formatting.
* Adds work-around for ``numpy``’s typing updates ([#16](#16)).
* Allows deployments to PyPI from CI based on tags.
* Exposes ``CachingProtocolMeta`` ([#15](#15)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants