Skip to content

[DISCUSSION] Adding public submodules to __all__ #2763

Closed
@harshil21

Description

@harshil21

What kind of feature are you missing? Where do you notice a shortcoming of PTB?

Currently, in the v14 branch we for e.g do: from telegram import error. But if a user does from telegram import *, it does not import the public submodule error, when it should.

PEP-8 says that documented interfaces are considered public and "To better support introspection, modules should explicitly declare the names in their public API using the __all__ attribute.".

Additionally, PEP-8 also says that __all__ should be placed above the imports.

Describe the solution you'd like

Import and add public submodules to __all__, place __all__ above imports.

Additional context

Original discussion: #2759 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions