Skip to content

Commit

Permalink
Bump version to v21.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Bibo-Joshi committed Mar 6, 2024
1 parent ae28587 commit 22eb434
Show file tree
Hide file tree
Showing 17 changed files with 127 additions and 79 deletions.
48 changes: 48 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,54 @@
Changelog
=========

Version 21.0
============

*Released 2024-03-06*

This is the technical changelog for version 21.0. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`__.

Major Changes
-------------

- Remove Functionality Deprecated in API 7.0 (:pr:`4114` closes :issue:`4099`)
- API 7.1 (:pr:`4118`)

New Features
------------

- Add Parameter ``media_write_timeout`` to ``HTTPXRequest`` and Method ``ApplicationBuilder.media_write_timeout`` (:pr:`4120` closes :issue:`3864`)
- Handle Properties in ``TelegramObject.__setstate__`` (:pr:`4134` closes :issue:`4111`)

Bug Fixes
---------

- Add Missing Slot to ``Updater`` (:pr:`4130` closes :issue:`4127`)

Documentation Improvements
--------------------------

- Improve HTML Download of Documentation (:pr:`4146` closes :issue:`4050`)
- Documentation Improvements (:pr:`4109`, :issue:`4116`)
- Update Copyright to 2024 (:pr:`4121` by `@aelkheir <https://github.com/aelkheir>`__ closes :issue:`4041`)

Internal Changes
----------------

- Apply ``pre-commit`` Checks More Widely (:pr:`4135`)
- Refactor and Overhaul ``test_official`` (:pr:`4087` closes :issue:`3874`)
- Run Unit Tests in PRs on Requirements Changes (:pr:`4144`)
- Make ``Updater.stop`` Independent of ``CancelledError`` (:pr:`4126`)

Dependency Updates
------------------

- Relax Upper Bound for ``httpx`` Dependency (:pr:`4148`)
- Bump ``test-summary/action`` from 2.2 to 2.3 (:pr:`4142`)
- Update ``cachetools`` requirement from ~=5.3.2 to ~=5.3.3 (:pr:`4141`)
- Update ``httpx`` requirement from ~=0.26.0 to ~=0.27.0 (:pr:`4131`)


Version 20.8
============

Expand Down
4 changes: 2 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
# built documents.
#
# The short X.Y version.
version = "20.8" # telegram.__version__[:3]
version = "21.0" # telegram.__version__[:3]
# The full version, including alpha/beta/rc tags.
release = "20.8" # telegram.__version__
release = "21.0" # telegram.__version__

# If your documentation needs a minimal Sphinx version, state it here.
needs_sphinx = "6.1.3"
Expand Down
76 changes: 38 additions & 38 deletions telegram/_bot.py

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions telegram/_chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,12 @@ class Chat(TelegramObject):
boosts that a non-administrator user needs to add in order to ignore slow mode and chat
permissions. Returned only in :meth:`telegram.Bot.get_chat`.
.. versionadded:: NEXT.VERSION
.. versionadded:: 21.0
custom_emoji_sticker_set_name (:obj:`str`, optional): For supergroups, the name of the
group's custom emoji sticker set. Custom emoji from this set can be used by all users
and bots in the group. Returned only in :meth:`telegram.Bot.get_chat`.
.. versionadded:: NEXT.VERSION
.. versionadded:: 21.0
Attributes:
id (:obj:`int`): Unique identifier for this chat. This number may be greater than 32 bits
Expand Down Expand Up @@ -366,12 +366,12 @@ class Chat(TelegramObject):
boosts that a non-administrator user needs to add in order to ignore slow mode and chat
permissions. Returned only in :meth:`telegram.Bot.get_chat`.
.. versionadded:: NEXT.VERSION
.. versionadded:: 21.0
custom_emoji_sticker_set_name (:obj:`str`): Optional. For supergroups, the name of the
group's custom emoji sticker set. Custom emoji from this set can be used by all users
and bots in the group. Returned only in :meth:`telegram.Bot.get_chat`.
.. versionadded:: NEXT.VERSION
.. versionadded:: 21.0
.. _topics: https://telegram.org/blog/topics-in-groups-collectible-usernames#topics-in-groups
.. _accent colors: https://core.telegram.org/bots/api#accent-colors
Expand Down
14 changes: 7 additions & 7 deletions telegram/_chatadministratorrights.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,19 @@ class ChatAdministratorRights(TelegramObject):
stories to the chat.
.. versionadded:: 20.6
.. versionchanged:: NEXT.VERSION
.. versionchanged:: 21.0
|non_optional_story_argument|
can_edit_stories (:obj:`bool`): :obj:`True`, if the administrator can edit
stories posted by other users.
.. versionadded:: 20.6
.. versionchanged:: NEXT.VERSION
.. versionchanged:: 21.0
|non_optional_story_argument|
can_delete_stories (:obj:`bool`): :obj:`True`, if the administrator can delete
stories posted by other users.
.. versionadded:: 20.6
.. versionchanged:: NEXT.VERSION
.. versionchanged:: 21.0
|non_optional_story_argument|
can_manage_topics (:obj:`bool`, optional): :obj:`True`, if the user is allowed
to create, rename, close, and reopen forum topics; for supergroups only.
Expand Down Expand Up @@ -121,19 +121,19 @@ class ChatAdministratorRights(TelegramObject):
stories to the chat.
.. versionadded:: 20.6
.. versionchanged:: NEXT.VERSION
.. versionchanged:: 21.0
|non_optional_story_argument|
can_edit_stories (:obj:`bool`): :obj:`True`, if the administrator can edit
stories posted by other users.
.. versionadded:: 20.6
.. versionchanged:: NEXT.VERSION
.. versionchanged:: 21.0
|non_optional_story_argument|
can_delete_stories (:obj:`bool`): :obj:`True`, if the administrator can delete
stories posted by other users.
.. versionadded:: 20.6
.. versionchanged:: NEXT.VERSION
.. versionchanged:: 21.0
|non_optional_story_argument|
can_manage_topics (:obj:`bool`): Optional. :obj:`True`, if the user is allowed
to create, rename, close, and reopen forum topics; for supergroups only.
Expand Down Expand Up @@ -192,7 +192,7 @@ def __init__(
# Not actually optionals but because of backwards compatability we pretend they are
if can_post_stories is None or can_edit_stories is None or can_delete_stories is None:
raise TypeError(
"As of vNEXT.VERSION can_post_stories, can_edit_stories and can_delete_stories"
"As of v21.0 can_post_stories, can_edit_stories and can_delete_stories"
" must be set in order to create this object."
)
self.can_post_stories: bool = can_post_stories
Expand Down
2 changes: 1 addition & 1 deletion telegram/_chatboost.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ChatBoostAdded(TelegramObject):
Two objects of this class are considered equal, if their
:attr:`boost_count` are equal.
.. versionadded:: NEXT.VERSION
.. versionadded:: 21.0
Args:
boost_count (:obj:`int`): Number of boosts added by the user.
Expand Down
14 changes: 7 additions & 7 deletions telegram/_chatmember.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,19 +228,19 @@ class ChatMemberAdministrator(ChatMember):
stories to the chat.
.. versionadded:: 20.6
.. versionchanged:: NEXT.VERSION
.. versionchanged:: 21.0
|non_optional_story_argument|
can_edit_stories (:obj:`bool`): :obj:`True`, if the administrator can edit
stories posted by other users.
.. versionadded:: 20.6
.. versionchanged:: NEXT.VERSION
.. versionchanged:: 21.0
|non_optional_story_argument|
can_delete_stories (:obj:`bool`): :obj:`True`, if the administrator can delete
stories posted by other users.
.. versionadded:: 20.6
.. versionchanged:: NEXT.VERSION
.. versionchanged:: 21.0
|non_optional_story_argument|
can_manage_topics (:obj:`bool`, optional): :obj:`True`, if the user is allowed
to create, rename, close, and reopen forum topics; for supergroups only.
Expand Down Expand Up @@ -287,19 +287,19 @@ class ChatMemberAdministrator(ChatMember):
stories to the chat.
.. versionadded:: 20.6
.. versionchanged:: NEXT.VERSION
.. versionchanged:: 21.0
|non_optional_story_argument|
can_edit_stories (:obj:`bool`): :obj:`True`, if the administrator can edit
stories posted by other users.
.. versionadded:: 20.6
.. versionchanged:: NEXT.VERSION
.. versionchanged:: 21.0
|non_optional_story_argument|
can_delete_stories (:obj:`bool`): :obj:`True`, if the administrator can delete
stories posted by other users.
.. versionadded:: 20.6
.. versionchanged:: NEXT.VERSION
.. versionchanged:: 21.0
|non_optional_story_argument|
can_manage_topics (:obj:`bool`): Optional. :obj:`True`, if the user is allowed
to create, rename, close, and reopen forum topics; for supergroups only
Expand Down Expand Up @@ -365,7 +365,7 @@ def __init__(
# Not actually optionals but because of backwards compatability we pretend they are
if can_post_stories is None or can_edit_stories is None or can_delete_stories is None:
raise TypeError(
"As of NEXT.VERSION can_post_stories, can_edit_stories and can_delete_stories "
"As of 21.0 can_post_stories, can_edit_stories and can_delete_stories "
"must be set in order to create this object."
)
self.can_post_stories: bool = can_post_stories
Expand Down
2 changes: 1 addition & 1 deletion telegram/_inline/inputtextmessagecontent.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class InputTextMessageContent(InputMessageContent):
argument. PTB will automatically convert this argument to that one, but
for advanced options, please use :paramref:`link_preview_options` directly.
.. versionchanged:: NEXT.VERSION
.. versionchanged:: 21.0
|keyword_only_arg|
Attributes:
Expand Down
2 changes: 1 addition & 1 deletion telegram/_keyboardbutton.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class KeyboardButton(TelegramObject):
versions released after 3 February, 2023. Older clients will display unsupported
message.
.. versionchanged:: NEXT.VERSION
.. versionchanged:: 21.0
Removed deprecated argument and attribute ``request_user``.
.. versionchanged:: 20.0
:attr:`web_app` is considered as well when comparing objects of this type in terms of
Expand Down
16 changes: 8 additions & 8 deletions telegram/_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class MaybeInaccessibleMessage(TelegramObject):
Objects of this class are comparable in terms of equality. Two objects of this class are
considered equal, if their :attr:`message_id` and :attr:`chat` are equal
.. versionchanged:: NEXT.VERSION
.. versionchanged:: 21.0
``__bool__`` is no longer overriden and defaults to Pythons standard implementation.
.. versionadded:: 20.8
Expand Down Expand Up @@ -244,7 +244,7 @@ class Message(MaybeInaccessibleMessage):
Note:
In Python :keyword:`from` is a reserved word. Use :paramref:`from_user` instead.
.. versionchanged:: NEXT.VERSION
.. versionchanged:: 21.0
Removed deprecated arguments and attributes ``user_shared``, ``forward_from``,
``forward_from_chat``, ``forward_from_message_id``, ``forward_signature``,
``forward_sender_name`` and ``forward_date``.
Expand Down Expand Up @@ -525,15 +525,15 @@ class Message(MaybeInaccessibleMessage):
reply_to_story (:class:`telegram.Story`, optional): For replies to a story, the original
story.
.. versionadded:: NEXT.VERSION
.. versionadded:: 21.0
boost_added (:class:`telegram.ChatBoostAdded`, optional): Service message: user boosted
the chat.
.. versionadded:: NEXT.VERSION
.. versionadded:: 21.0
sender_boost_count (:obj:`int`, optional): If the sender of the
message boosted the chat, the number of boosts added by the user.
.. versionadded:: NEXT.VERSION
.. versionadded:: 21.0
Attributes:
message_id (:obj:`int`): Unique message identifier inside this chat.
Expand Down Expand Up @@ -807,15 +807,15 @@ class Message(MaybeInaccessibleMessage):
reply_to_story (:class:`telegram.Story`): Optional. For replies to a story, the original
story.
.. versionadded:: NEXT.VERSION
.. versionadded:: 21.0
boost_added (:class:`telegram.ChatBoostAdded`): Optional. Service message: user boosted
the chat.
.. versionadded:: NEXT.VERSION
.. versionadded:: 21.0
sender_boost_count (:obj:`int`): Optional. If the sender of the
message boosted the chat, the number of boosts added by the user.
.. versionadded:: NEXT.VERSION
.. versionadded:: 21.0
.. |custom_emoji_no_md1_support| replace:: Since custom emoji entities are not supported by
:attr:`~telegram.constants.ParseMode.MARKDOWN`, this method now raises a
Expand Down
2 changes: 1 addition & 1 deletion telegram/_story.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Story(TelegramObject):
.. versionadded:: 20.5
.. versionchanged:: NEXT.VERSION
.. versionchanged:: 21.0
Added attributes :attr:`chat` and :attr:`id` and equality based on them.
Args:
Expand Down
2 changes: 1 addition & 1 deletion telegram/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def __str__(self) -> str:


__version_info__: Final[Version] = Version(
major=20, minor=8, micro=0, releaselevel="final", serial=0
major=21, minor=0, micro=0, releaselevel="final", serial=0
)
__version__: Final[str] = str(__version_info__)

Expand Down
6 changes: 3 additions & 3 deletions telegram/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -1708,7 +1708,7 @@ class MessageType(StringEnum):
BOOST_ADDED = "boost_added"
""":obj:`str`: Messages with :attr:`telegram.Message.boost_added`.
.. versionadded:: NEXT.VERSION
.. versionadded:: 21.0
"""
CHANNEL_CHAT_CREATED = "channel_chat_created"
""":obj:`str`: Messages with :attr:`telegram.Message.channel_chat_created`."""
Expand Down Expand Up @@ -1810,12 +1810,12 @@ class MessageType(StringEnum):
REPLY_TO_STORY = "reply_to_story"
""":obj:`str`: Messages with :attr:`telegram.Message.reply_to_story`.
.. versionadded:: NEXT.VERSION
.. versionadded:: 21.0
"""
SENDER_BOOST_COUNT = "sender_boost_count"
""":obj:`str`: Messages with :attr:`telegram.Message.sender_boost_count`.
.. versionadded:: NEXT.VERSION
.. versionadded:: 21.0
"""
STICKER = "sticker"
""":obj:`str`: Messages with :attr:`telegram.Message.sticker`."""
Expand Down
2 changes: 1 addition & 1 deletion telegram/ext/_applicationbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ def media_write_timeout(
:paramref:`~telegram.request.HTTPXRequest.media_write_timeout` parameter of
:attr:`telegram.Bot.request`. Defaults to ``20``.
.. versionadded:: NEXT.VERSION
.. versionadded:: 21.0
Args:
media_write_timeout (:obj:`float`): See
Expand Down
2 changes: 1 addition & 1 deletion telegram/ext/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -2158,7 +2158,7 @@ def filter(self, message: Message) -> bool:
This will only catch the legacy ``user_shared`` field, not the
new :attr:`telegram.Message.users_shared` attribute!
.. versionchanged:: NEXT.VERSION
.. versionchanged:: 21.0
Now relies on :attr:`telegram.TelegramObject.api_kwargs` as the native attribute
``Message.user_shared`` was removed.
Expand Down
2 changes: 1 addition & 1 deletion telegram/request/_httpxrequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class HTTPXRequest(BaseRequest):
different value is passed to :paramref:`do_request.write_timeout` of
:meth:`do_request`. Defaults to ``20`` seconds.
.. versionadded:: NEXT.VERSION
.. versionadded:: 21.0
"""

Expand Down
4 changes: 2 additions & 2 deletions tests/test_official/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def ptb_extra_params(object_name: str) -> set[str]:
# Mostly due to the value being fixed anyway
PTB_IGNORED_PARAMS = {
r"InlineQueryResult\w+": {"type"},
# TODO: Remove this in vNEXT.VERSION (API 7.1) when this can stop being optional
# TODO: Remove this in v21.0 (API 7.1) when this can stop being optional
r"ChatAdministratorRights": {"can_post_stories", "can_edit_stories", "can_delete_stories"},
r"ChatMemberAdministrator": {"can_post_stories", "can_edit_stories", "can_delete_stories"},
r"ChatMember\w+": {"status"},
Expand Down Expand Up @@ -170,7 +170,7 @@ def ignored_param_requirements(object_name: str) -> set[str]:

# Arguments that are optional arguments for now for backwards compatibility
BACKWARDS_COMPAT_KWARGS: dict[str, set[str]] = {
# TODO: Remove this in vNEXT.VERSION (API 7.1) when this can stop being optional
# TODO: Remove this in v21.0 (API 7.1) when this can stop being optional
r"ChatAdministratorRights": {"can_post_stories", "can_edit_stories", "can_delete_stories"},
r"ChatMemberAdministrator": {"can_post_stories", "can_edit_stories", "can_delete_stories"},
}
Expand Down

0 comments on commit 22eb434

Please sign in to comment.