-
Notifications
You must be signed in to change notification settings - Fork 18
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
Use __all__ in every public module to control which names are exported #214
Comments
Question regarding the expectations here. Do you just want to expose all the current files/modules as is or hide in which file they actually reside. Ex. from openfeature import api
from openfeature.client import OpenFeatureClient
from openfeature.provider.in_memory_provider import InMemoryFlag, InMemoryProvider or this from openfeature import api
from openfeature import OpenFeatureClient
from openfeature.provider import InMemoryFlag, InMemoryProvider |
There is room to keep improving the public module hierarchy. The only thing we should avoid is making multiple releases with breaking changes. If we are going to make changes on this then we should bundle all of them together in a single release so that users only have to migrate once. My current thinking is that we should use For a good reference on this check out how the opentelemetry-python SDK does it. As for your specific question, I don't have a strong preference either way for the OpenFeatureClient import, but the InMemoryProvider one is probably more idiomatic as |
What I have said is not established convention, just my own curated best practices from years of working with Python. Feel free to suggest alternatives. |
One big issue with the current module hierarchy is that the API is commonly imported as: from openfeature import api Or worse: from openfeature.api import set_provider Neither of these names ( import openfeature
openfeature.set_provider(provider) Or, if you want: import openfeature as of
of.set_provider() |
Typically I prefer to expose the most important ones directly at the root level of the package and less frequent used ones through the their sub namespace. But I think your suggestion can't be implemented, because |
Yeah, I remember now that's the reason we didn't do it before. I think a good step forward would be to compile a list of suggestions for improving the public package structure and then do these changes all in one go. |
Hey @federicobond, can this be closed now? |
Yeah, this is done 😄 |
No description provided.
The text was updated successfully, but these errors were encountered: