diff --git a/README.rst b/README.rst index 76743bf0250..d9a61b5c95c 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,3 @@ -.. - Make sure to apply any changes to this file to README_RAW.rst as well! - .. image:: https://raw.githubusercontent.com/python-telegram-bot/logos/master/logo-text/png/ptb-logo-text_768.png :align: center :target: https://python-telegram-bot.org @@ -79,13 +76,6 @@ In addition to the pure API implementation, this library features a number of hi make the development of bots easy and straightforward. These classes are contained in the ``telegram.ext`` submodule. -A pure API implementation *without* ``telegram.ext`` is available as the standalone package ``python-telegram-bot-raw``. `See here for details. `_ - -Note ----- - -Installing both ``python-telegram-bot`` and ``python-telegram-bot-raw`` in conjunction will result in undesired side-effects, so only install *one* of both. - Telegram API support ==================== diff --git a/README_RAW.rst b/README_RAW.rst index 45f636bc2f7..64f83121e21 100644 --- a/README_RAW.rst +++ b/README_RAW.rst @@ -1,6 +1,3 @@ -.. - Make sure to apply any changes to this file to README.rst as well! - .. image:: https://github.com/python-telegram-bot/logos/blob/master/logo-text/png/ptb-raw-logo-text_768.png?raw=true :align: center :target: https://python-telegram-bot.org @@ -62,6 +59,16 @@ :target: https://telegram.me/pythontelegrambotgroup :alt: Telegram Group +⚠️ Deprecation Notice +===================== + +The ``python-telegram-bot-raw`` library will no longer be updated after NEXT.VERSION. +Please instead use the ``python-telegram-bot`` `library `_. +The change requires no changes in your code and requires no additional dependencies. +For additional information, please see this `channel post `_. + +---- + We have made you a wrapper you can't refuse We have a vibrant community of developers helping each other in our `Telegram group `_. Join us! diff --git a/telegram/__init__.py b/telegram/__init__.py index 5e0f3eaac3b..1230716e785 100644 --- a/telegram/__init__.py +++ b/telegram/__init__.py @@ -242,6 +242,7 @@ "warnings", ) +from pathlib import Path from . import _version, constants, error, helpers, request, warnings from ._birthdate import Birthdate @@ -442,6 +443,7 @@ from ._update import Update from ._user import User from ._userprofilephotos import UserProfilePhotos +from ._utils.warnings import warn from ._videochat import ( VideoChatEnded, VideoChatParticipantsInvited, @@ -475,3 +477,28 @@ #: #: .. versionadded:: 20.0 __bot_api_version_info__: constants._BotAPIVersion = _version.__bot_api_version_info__ + + +if not (Path(__file__).parent.resolve().absolute() / "ext").exists(): + _MESSAGE = ( + "Hey. You seem to be using the `python-telegram-bot-raw` library. " + "Please note that this libray has been deprecated and will no longer be updated. " + "Please instead use the `python-telegram-bot` library. The change requires no " + "changes in your code and requires no additional dependencies. For additional " + "information, please see the channel post at " + "https://t.me/pythontelegrambotchannel/145." + ) + + # DeprecationWarning is ignored by default in Python 3.7 and later by default outside + # __main__ modules. We use both warning categories to increase the chance of the user + # seeing the warning. + + warn( + warnings.PTBDeprecationWarning(version="NEXT.VERSION", message=_MESSAGE), + stacklevel=2, + ) + warn( + message=_MESSAGE, + category=warnings.PTBUserWarning, + stacklevel=2, + ) diff --git a/telegram/_utils/datetime.py b/telegram/_utils/datetime.py index 9790e27857d..1c0da085434 100644 --- a/telegram/_utils/datetime.py +++ b/telegram/_utils/datetime.py @@ -194,7 +194,7 @@ def extract_tzinfo_from_defaults(bot: "Bot") -> Union[dtm.tzinfo, None]: If the bot has no default values, :obj:`None` is returned. """ # We don't use `ininstance(bot, ExtBot)` here so that this works - # in `python-telegram-bot-raw` as well + # without the job-queue extra dependencies as well if hasattr(bot, "defaults") and bot.defaults: return bot.defaults.tzinfo return None