Bump Version to v20.7

This commit is contained in:
Hinrich Mahler 2023-11-27 19:01:57 +01:00
parent da11561f87
commit a8f1164b0c
11 changed files with 81 additions and 32 deletions

View file

@ -4,6 +4,55 @@
Changelog Changelog
========= =========
Version 20.6
============
*Released 2023-11-27*
This is the technical changelog for version 20.6. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`__.
New Features
------------
- Add ``JobQueue.scheduler_configuration`` and Corresponding Warnings (:pr:`3913` closes :issue:`3837`)
- Add Parameter ``socket_options`` to ``HTTPXRequest`` (:pr:`3935` closes :issue:`2965`)
- Add ``ApplicationBuilder.(get_updates_)socket_options`` (:pr:`3943`)
- Improve ``write_timeout`` Handling for Media Methods (:pr:`3952`)
- Add ``filters.Mention`` (:pr:`3941` closes :issue:`3799`)
- Rename ``proxy_url`` to ``proxy`` and Allow ``httpx.{Proxy, URL}`` as Input (:pr:`3939` closes :issue:`3844`)
Bug Fixes & Changes
-------------------
- Adjust ``read_timeout`` Behavior for ``Bot.get_updates`` (:pr:`3963` closes :issue:`3893`)
- Improve ``BaseHandler.__repr__`` for Callbacks without ``__qualname__`` (:pr:`3934`)
- Fix Persistency Issue with Ended Non-Blocking Conversations (:pr:`3962`)
- Improve Type Hinting for Arguments with Default Values in ``Bot`` (:pr:`3942`)
Documentation Improvements
--------------------------
- Add Documentation for ``__aenter__`` and ``__aexit__`` Methods (:pr:`3907` closes :issue:`3886`)
- Improve Insertion of Kwargs into ``Bot`` Methods (:pr:`3965`)
Internal Changes
----------------
- Adjust Tests to New Error Messages (:pr:`3970`)
Dependency Updates
------------------
- Bump ``pytest-xdist`` from 3.3.1 to 3.4.0 (:pr:`3975`)
- ``pre-commit`` autoupdate (:pr:`3967`)
- Update ``httpx`` requirement from ~=0.25.1 to ~=0.25.2 (:pr:`3983`)
- Bump ``pytest-xdist`` from 3.4.0 to 3.5.0 (:pr:`3982`)
- Update ``httpx`` requirement from ~=0.25.0 to ~=0.25.1 (:pr:`3961`)
- Bump ``srvaroa/labeler`` from 1.6.1 to 1.7.0 (:pr:`3958`)
- Update ``cachetools`` requirement from ~=5.3.1 to ~=5.3.2 (:pr:`3954`)
- Bump ``pytest`` from 7.4.2 to 7.4.3 (:pr:`3953`)
Version 20.6 Version 20.6
============ ============

View file

@ -67,7 +67,7 @@ media_write_timeout_deprecation = [
" seconds are used as write timeout." " seconds are used as write timeout."
"", "",
"", "",
" .. deprecated:: NEXT.VERSION", " .. deprecated:: 20.7",
" In future versions, the default value will be changed to " " In future versions, the default value will be changed to "
" :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.", " :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.",
"", "",
@ -77,7 +77,7 @@ get_updates_read_timeout_addition = [
" :paramref:`timeout` will be added to this value.", " :paramref:`timeout` will be added to this value.",
"", "",
"", "",
" .. versionchanged:: NEXT.VERSION", " .. versionchanged:: 20.7",
" Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE` instead of ", " Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE` instead of ",
" ``2``.", " ``2``.",
] ]

View file

@ -21,9 +21,9 @@ author = "Leandro Toledo"
# built documents. # built documents.
# #
# The short X.Y version. # The short X.Y version.
version = "20.6" # telegram.__version__[:3] version = "20.7" # telegram.__version__[:3]
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = "20.6" # telegram.__version__ release = "20.7" # telegram.__version__
# If your documentation needs a minimal Sphinx version, state it here. # If your documentation needs a minimal Sphinx version, state it here.
needs_sphinx = "6.1.3" needs_sphinx = "6.1.3"

View file

@ -51,7 +51,7 @@ class Version(NamedTuple):
__version_info__: Final[Version] = Version( __version_info__: Final[Version] = Version(
major=20, minor=6, micro=0, releaselevel="final", serial=0 major=20, minor=7, micro=0, releaselevel="final", serial=0
) )
__version__: Final[str] = str(__version_info__) __version__: Final[str] = str(__version_info__)

View file

@ -748,32 +748,32 @@ class Application(Generic[BT, CCT, UD, CD, BD, JQ], AsyncContextManager["Applica
:paramref:`telegram.Bot.get_updates.read_timeout`. Defaults to :paramref:`telegram.Bot.get_updates.read_timeout`. Defaults to
:attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.
.. versionchanged:: NEXT.VERSION .. versionchanged:: 20.7
Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE` instead of Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE` instead of
``2``. ``2``.
.. deprecated:: NEXT.VERSION .. deprecated:: 20.7
Deprecated in favor of setting the timeout via Deprecated in favor of setting the timeout via
:meth:`telegram.ext.ApplicationBuilder.get_updates_read_timeout`. :meth:`telegram.ext.ApplicationBuilder.get_updates_read_timeout`.
write_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to write_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to
:paramref:`telegram.Bot.get_updates.write_timeout`. Defaults to :paramref:`telegram.Bot.get_updates.write_timeout`. Defaults to
:attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.
.. deprecated:: NEXT.VERSION .. deprecated:: 20.7
Deprecated in favor of setting the timeout via Deprecated in favor of setting the timeout via
:meth:`telegram.ext.ApplicationBuilder.get_updates_write_timeout`. :meth:`telegram.ext.ApplicationBuilder.get_updates_write_timeout`.
connect_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to connect_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to
:paramref:`telegram.Bot.get_updates.connect_timeout`. Defaults to :paramref:`telegram.Bot.get_updates.connect_timeout`. Defaults to
:attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.
.. deprecated:: NEXT.VERSION .. deprecated:: 20.7
Deprecated in favor of setting the timeout via Deprecated in favor of setting the timeout via
:meth:`telegram.ext.ApplicationBuilder.get_updates_connect_timeout`. :meth:`telegram.ext.ApplicationBuilder.get_updates_connect_timeout`.
pool_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to pool_timeout (:obj:`float` | :obj:`None`, optional): Value to pass to
:paramref:`telegram.Bot.get_updates.pool_timeout`. Defaults to :paramref:`telegram.Bot.get_updates.pool_timeout`. Defaults to
:attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.
.. deprecated:: NEXT.VERSION .. deprecated:: 20.7
Deprecated in favor of setting the timeout via Deprecated in favor of setting the timeout via
:meth:`telegram.ext.ApplicationBuilder.get_updates_pool_timeout`. :meth:`telegram.ext.ApplicationBuilder.get_updates_pool_timeout`.
drop_pending_updates (:obj:`bool`, optional): Whether to clean any pending updates on drop_pending_updates (:obj:`bool`, optional): Whether to clean any pending updates on

View file

@ -507,7 +507,7 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
.. seealso:: :meth:`get_updates_proxy` .. seealso:: :meth:`get_updates_proxy`
.. deprecated:: NEXT.VERSION .. deprecated:: 20.7
Args: Args:
proxy_url (:obj:`str` | ``httpx.Proxy`` | ``httpx.URL``): See proxy_url (:obj:`str` | ``httpx.Proxy`` | ``httpx.URL``): See
@ -518,7 +518,7 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
""" """
warn( warn(
"`ApplicationBuilder.proxy_url` is deprecated since version " "`ApplicationBuilder.proxy_url` is deprecated since version "
"NEXT.VERSION. Use `ApplicationBuilder.proxy` instead.", "20.7. Use `ApplicationBuilder.proxy` instead.",
PTBDeprecationWarning, PTBDeprecationWarning,
stacklevel=2, stacklevel=2,
) )
@ -530,7 +530,7 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
.. seealso:: :meth:`get_updates_proxy` .. seealso:: :meth:`get_updates_proxy`
.. versionadded:: NEXT.VERSION .. versionadded:: 20.7
Args: Args:
proxy (:obj:`str` | ``httpx.Proxy`` | ``httpx.URL``): The URL to a proxy proxy (:obj:`str` | ``httpx.Proxy`` | ``httpx.URL``): The URL to a proxy
@ -550,7 +550,7 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
.. seealso:: :meth:`get_updates_socket_options` .. seealso:: :meth:`get_updates_socket_options`
.. versionadded:: NEXT.VERSION .. versionadded:: 20.7
Args: Args:
socket_options (Collection[:obj:`tuple`], optional): Socket options. See socket_options (Collection[:obj:`tuple`], optional): Socket options. See
@ -719,7 +719,7 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
.. seealso:: :meth:`proxy` .. seealso:: :meth:`proxy`
.. deprecated:: NEXT.VERSION .. deprecated:: 20.7
Args: Args:
get_updates_proxy_url (:obj:`str` | ``httpx.Proxy`` | ``httpx.URL``): See get_updates_proxy_url (:obj:`str` | ``httpx.Proxy`` | ``httpx.URL``): See
@ -730,7 +730,7 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
""" """
warn( warn(
"`ApplicationBuilder.get_updates_proxy_url` is deprecated since version " "`ApplicationBuilder.get_updates_proxy_url` is deprecated since version "
"NEXT.VERSION. Use `ApplicationBuilder.get_updates_proxy` instead.", "20.7. Use `ApplicationBuilder.get_updates_proxy` instead.",
PTBDeprecationWarning, PTBDeprecationWarning,
stacklevel=2, stacklevel=2,
) )
@ -744,7 +744,7 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
.. seealso:: :meth:`proxy` .. seealso:: :meth:`proxy`
.. versionadded:: NEXT.VERSION .. versionadded:: 20.7
Args: Args:
proxy (:obj:`str` | ``httpx.Proxy`` | ``httpx.URL``): The URL to a proxy server, proxy (:obj:`str` | ``httpx.Proxy`` | ``httpx.URL``): The URL to a proxy server,
@ -766,7 +766,7 @@ class ApplicationBuilder(Generic[BT, CCT, UD, CD, BD, JQ]):
.. seealso:: :meth:`socket_options` .. seealso:: :meth:`socket_options`
.. versionadded:: NEXT.VERSION .. versionadded:: 20.7
Args: Args:
get_updates_socket_options (Collection[:obj:`tuple`], optional): Socket options. See get_updates_socket_options (Collection[:obj:`tuple`], optional): Socket options. See

View file

@ -146,7 +146,7 @@ class JobQueue(Generic[CCT]):
:meth:`~apscheduler.schedulers.base.BaseScheduler.add_jobstore` to avoid using :meth:`~apscheduler.schedulers.base.BaseScheduler.add_jobstore` to avoid using
:meth:`~apscheduler.schedulers.base.BaseScheduler.configure` altogether. :meth:`~apscheduler.schedulers.base.BaseScheduler.configure` altogether.
.. versionadded:: NEXT.VERSION .. versionadded:: 20.7
Returns: Returns:
Dict[:obj:`str`, :obj:`object`]: The configuration values as dictionary. Dict[:obj:`str`, :obj:`object`]: The configuration values as dictionary.

View file

@ -239,10 +239,10 @@ class Updater(AsyncContextManager["Updater"]):
:paramref:`telegram.Bot.get_updates.read_timeout`. Defaults to :paramref:`telegram.Bot.get_updates.read_timeout`. Defaults to
:attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.
.. versionchanged:: NEXT.VERSION .. versionchanged:: 20.7
Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE` instead of Defaults to :attr:`~telegram.request.BaseRequest.DEFAULT_NONE` instead of
``2``. ``2``.
.. deprecated:: NEXT.VERSION .. deprecated:: 20.7
Deprecated in favor of setting the timeout via Deprecated in favor of setting the timeout via
:meth:`telegram.ext.ApplicationBuilder.get_updates_read_timeout` or :meth:`telegram.ext.ApplicationBuilder.get_updates_read_timeout` or
:paramref:`telegram.Bot.get_updates_request`. :paramref:`telegram.Bot.get_updates_request`.
@ -250,7 +250,7 @@ class Updater(AsyncContextManager["Updater"]):
:paramref:`telegram.Bot.get_updates.write_timeout`. Defaults to :paramref:`telegram.Bot.get_updates.write_timeout`. Defaults to
:attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.
.. deprecated:: NEXT.VERSION .. deprecated:: 20.7
Deprecated in favor of setting the timeout via Deprecated in favor of setting the timeout via
:meth:`telegram.ext.ApplicationBuilder.get_updates_write_timeout` or :meth:`telegram.ext.ApplicationBuilder.get_updates_write_timeout` or
:paramref:`telegram.Bot.get_updates_request`. :paramref:`telegram.Bot.get_updates_request`.
@ -258,7 +258,7 @@ class Updater(AsyncContextManager["Updater"]):
:paramref:`telegram.Bot.get_updates.connect_timeout`. Defaults to :paramref:`telegram.Bot.get_updates.connect_timeout`. Defaults to
:attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.
.. deprecated:: NEXT.VERSION .. deprecated:: 20.7
Deprecated in favor of setting the timeout via Deprecated in favor of setting the timeout via
:meth:`telegram.ext.ApplicationBuilder.get_updates_connect_timeout` or :meth:`telegram.ext.ApplicationBuilder.get_updates_connect_timeout` or
:paramref:`telegram.Bot.get_updates_request`. :paramref:`telegram.Bot.get_updates_request`.
@ -266,7 +266,7 @@ class Updater(AsyncContextManager["Updater"]):
:paramref:`telegram.Bot.get_updates.pool_timeout`. Defaults to :paramref:`telegram.Bot.get_updates.pool_timeout`. Defaults to
:attr:`~telegram.request.BaseRequest.DEFAULT_NONE`. :attr:`~telegram.request.BaseRequest.DEFAULT_NONE`.
.. deprecated:: NEXT.VERSION .. deprecated:: 20.7
Deprecated in favor of setting the timeout via Deprecated in favor of setting the timeout via
:meth:`telegram.ext.ApplicationBuilder.get_updates_pool_timeout` or :meth:`telegram.ext.ApplicationBuilder.get_updates_pool_timeout` or
:paramref:`telegram.Bot.get_updates_request`. :paramref:`telegram.Bot.get_updates_request`.

View file

@ -1531,7 +1531,7 @@ class Mention(MessageFilter):
MessageHandler(filters.Mention("username"), callback) MessageHandler(filters.Mention("username"), callback)
MessageHandler(filters.Mention(["@username", 123456]), callback) MessageHandler(filters.Mention(["@username", 123456]), callback)
.. versionadded:: NEXT.VERSION .. versionadded:: 20.7
Args: Args:
mentions (:obj:`int` | :obj:`str` | :class:`telegram.User` | Collection[:obj:`int` | \ mentions (:obj:`int` | :obj:`str` | :class:`telegram.User` | Collection[:obj:`int` | \

View file

@ -136,7 +136,7 @@ class BaseRequest(
More precisely, the returned value should be the one used when More precisely, the returned value should be the one used when
:paramref:`post.read_timeout` of :meth:post` is not passed/equal to :attr:`DEFAULT_NONE`. :paramref:`post.read_timeout` of :meth:post` is not passed/equal to :attr:`DEFAULT_NONE`.
.. versionadded:: NEXT.VERSION .. versionadded:: 20.7
Warning: Warning:
For now this property does not need to be implemented by subclasses and will raise For now this property does not need to be implemented by subclasses and will raise
@ -308,7 +308,7 @@ class BaseRequest(
# 20 is the documented default value for all the media related bot methods and custom # 20 is the documented default value for all the media related bot methods and custom
# implementations of BaseRequest may explicitly rely on that. Hence, we follow the # implementations of BaseRequest may explicitly rely on that. Hence, we follow the
# standard deprecation policy and deprecate starting with version NEXT.VERSION. # standard deprecation policy and deprecate starting with version 20.7.
# For our own implementation HTTPXRequest, we can handle that ourselves, so we skip the # For our own implementation HTTPXRequest, we can handle that ourselves, so we skip the
# warning in that case. # warning in that case.
has_files = request_data and request_data.multipart_data has_files = request_data and request_data.multipart_data

View file

@ -54,7 +54,7 @@ class HTTPXRequest(BaseRequest):
proxy_url (:obj:`str`, optional): Legacy name for :paramref:`proxy`, kept for backward proxy_url (:obj:`str`, optional): Legacy name for :paramref:`proxy`, kept for backward
compatibility. Defaults to :obj:`None`. compatibility. Defaults to :obj:`None`.
.. deprecated:: NEXT.VERSION .. deprecated:: 20.7
read_timeout (:obj:`float` | :obj:`None`, optional): If passed, specifies the maximum read_timeout (:obj:`float` | :obj:`None`, optional): If passed, specifies the maximum
amount of time (in seconds) to wait for a response from Telegram's server. amount of time (in seconds) to wait for a response from Telegram's server.
This value is used unless a different value is passed to :meth:`do_request`. This value is used unless a different value is passed to :meth:`do_request`.
@ -95,7 +95,7 @@ class HTTPXRequest(BaseRequest):
This is a low-level parameter and should only be used if you are familiar with This is a low-level parameter and should only be used if you are familiar with
these concepts. these concepts.
.. versionadded:: NEXT.VERSION .. versionadded:: 20.7
proxy (:obj:`str` | ``httpx.Proxy`` | ``httpx.URL``, optional): The URL to a proxy server, proxy (:obj:`str` | ``httpx.Proxy`` | ``httpx.URL``, optional): The URL to a proxy server,
a ``httpx.Proxy`` object or a ``httpx.URL`` object. For example a ``httpx.Proxy`` object or a ``httpx.URL`` object. For example
``'http://127.0.0.1:3128'`` or ``'socks5://127.0.0.1:3128'``. Defaults to :obj:`None`. ``'http://127.0.0.1:3128'`` or ``'socks5://127.0.0.1:3128'``. Defaults to :obj:`None`.
@ -111,7 +111,7 @@ class HTTPXRequest(BaseRequest):
.. _the docs of httpx: https://www.python-httpx.org/environment_variables/#proxies .. _the docs of httpx: https://www.python-httpx.org/environment_variables/#proxies
.. versionadded:: NEXT.VERSION .. versionadded:: 20.7
""" """
@ -135,7 +135,7 @@ class HTTPXRequest(BaseRequest):
if proxy_url is not None: if proxy_url is not None:
proxy = proxy_url proxy = proxy_url
warn( warn(
"The parameter `proxy_url` is deprecated since version NEXT.VERSION. Use `proxy` " "The parameter `proxy_url` is deprecated since version 20.7. Use `proxy` "
"instead.", "instead.",
PTBDeprecationWarning, PTBDeprecationWarning,
stacklevel=2, stacklevel=2,
@ -252,7 +252,7 @@ class HTTPXRequest(BaseRequest):
if isinstance(write_timeout, DefaultValue): if isinstance(write_timeout, DefaultValue):
# Making the networking backend decide on the proper timeout values instead of doing # Making the networking backend decide on the proper timeout values instead of doing
# it via the default values of the Bot methods was introduced in version NEXT.VERSION. # it via the default values of the Bot methods was introduced in version 20.7.
# We hard-code the value here for now until we add additional parameters to this # We hard-code the value here for now until we add additional parameters to this
# class to control the media_write_timeout separately. # class to control the media_write_timeout separately.
write_timeout = self._client.timeout.write if not files else 20 write_timeout = self._client.timeout.write if not files else 20