How to make "private" identifiers easily accessible within a package. #19651
Replies: 1 comment 1 reply
-
I'm not sure I totally understand the request here. If you want to suppress F401 in this example, I think you should be able to use: # __init__.py
from stubFileNotFound._theSSOT import settingsPackage as settingsPackage or # __init__.py
from stubFileNotFound._theSSOT import settingsPackage
__all__ = ["settingsPackage"] Are those the pieces of advice in the docs that don't seem applicable? I think if you want to indicate that it's part of a private API, you would name it something like |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
N.B. I fixed a mistake and clarified a pronoun.
Representative code
Goals
stubFileNotFound.stubFileNotFound
stubFileNotFound.settingsPackage
to be a stable, predictable identifier for every module in this package. (Actually, I wantit*.settingsPackage
to be a stable, predictable identifier in every package I make.)unused-import (F401)
The advice on the F401 page doesn't seem to apply to my situation, so I suspect that I ought to be using a different mechanism to achieve my goals. I read the linked resources, such as Library interface (public and private symbols). If the information I need is in those resources, then I overlooked it.
Your guidance, especially pointing me to paradigms
This precise issue described above is relatively trivial. On the other hand, I believe managing the logical namespace is exceptionally important. I suspect that if I were to better understand this minor issue, then I could better cope with the frustrating #$%&&#$^% Python namespace, you know?
Beta Was this translation helpful? Give feedback.
All reactions