-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Further clear up imports policy: Private modules #2680
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
Comments
Hi, I would like to work on this! |
Nice :) I assigned you. |
mypy's type checking fails when some modules are made private with a leading underscore. The modules affected are: For example, in a branch where only I have not identified the common cause yet as its my first time working with mypy. Hope someone can point me in the right direction, thanks! :) |
Hi. This is in deed a bit tricky, so no worries :D Lines 61 to 64 in c3e3bb7
If you change the names to leading underscores here, too, it should work. If there are any mypy errors left that you can't resolve, you can just PR and we'll have a look together :) BTW: We indeed aim to resolve this mypy-workaround with #2505 |
Thanks that was indeed the issue. Its fixed now and I just opened a PR :) |
Is your feature request related to a problem? Please describe.
Currently all the modules like
telegram.{message, chat, user, …}
look like they are public. However, we don't consider them to be part of the public API and they should not be treated as such by the user. The only thing that we guarantee to work isfrom telegram import Message, Chat, User, …
and notfrom telegram.message import Message
.Describe the solution you'd like
Rename all the private modules with a leading underscore, i.e. all files that contain classes that are imported in the
__init__
.This is in accordance with PEP8:
this should also be done for the
telegram.ext
package except for the moduletelegram.ext.filters
. The packagestelegram(.ext).utils
should also be renamed totelegram(.ext)._utils
and dropped from the documentation - unless this leads to pre-commit complaining about importing private packages. If it does, we'll have to re-evaluate.Additional context
The text was updated successfully, but these errors were encountered: