Skip to content

Further clear up imports policy: Private modules #2680

@Bibo-Joshi

Description

@Bibo-Joshi

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 is from telegram import Message, Chat, User, … and not from 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:

Even with __all__ set appropriately, internal interfaces (packages, modules, classes, functions, attributes or other names) should still be prefixed with a single leading underscore.

this should also be done for the telegram.ext package except for the module telegram.ext.filters. The packages telegram(.ext).utils should also be renamed to telegram(.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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions