Skip to content

Clear up imports policy #2468

@Bibo-Joshi

Description

@Bibo-Joshi

We're currently not very consistent regarding what we make available directly via telegram.__init__ and what we don't. Some examples:

  • from telegram.error only TelegramError is available via telegram.__init__, but no of the other classes
  • from telegram.constants only some few constants are available.
  • TelegramDeprecationWarning is not available (see also Overhaul of warnings #2467)
  • the helper methods from utils.helper that are actually there to be used by users and not exclusively by PTB itself (e.g. escape_markdown, mention_user_*) are not available

IMO we should try to make a clear policy for this. IMHO it should be clear that all API-classes are directly available through telgeram. All the things mentioned above are from … lets call them "auxiliary modules". For these I basically see two options:

  1. Make all of that available directly through telegram
  2. Make none of it available through telegram. In this case I'd vote to at least move the above mentioned helper methods directly to telegram.utils and spare the user the .helpers, especially as users are in general not to be concerned with the other contents of utils.

Case 2 would be breaking & in that case we should wait until v14.
In any case I would aim to document the import policy somewhere … probably just at the index of the docs.
I'm slightly in favor of 2. What do the other @python-telegram-bot/developers think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy