python-telegram-bot
15.6K subscribers
90 links
The official channel for the python-telegram-bot library | https://python-telegram-bot.org
Download Telegram
We’ve just released v20.4.

Thank you to everyone who contributed to this release.

As usual, upgrade using pip install -U python-telegram-bot.

This update drops support for Python 3.7, which reached its end of life on June 6th. python-telegram-bot now requires Python 3.8 or higher.

Moreover, this update introduces a new mechanism that allows to customize the concurrent handling of updates. This makes it possible to e.g. handle updates different chats concurrently while still processing updates from the same chat sequentially. See the updated wiki page on concurrency and the documentation of the new BaseUpdateProcessor class for more information.

Major Changes

• Drop Support for Python 3.7 (#3728, #3742 by @Trifase, #3749 by @thefunkycat, #3740 closes #3732, #3754 closes #3731, #3753, #3764, #3762, #3759 closes #3733)

New Features

• Make Integration of APScheduler into JobQueue More Explicit (#3695)
• Introduce BaseUpdateProcessor for Customized Concurrent Handling of Updates (#3654 closes #3509)

Minor Changes

• Fix Inconsistent Type Hints for timeout Parameter of Bot.get_updates (#3709 by @revolter)
• Use Explicit Optionals (#3692 by @MiguelX413)

Bug Fixes

• Fix Wrong Warning Text in KeyboardButton.__eq__ (#3768)

Documentation Improvements

• Explicitly set allowed_updates in Examples (#3741 by @Trifase closes #3726)
• Bump furo and sphinx (#3719)
• Documentation Improvements (#3698, #3708 by @revolter, #3767)
• Add Quotes for Installation Instructions With Optional Dependencies (#3780)
• Exclude Type Hints from Stability Policy (#3712)
• Set httpx Logging Level to Warning in Examples (#3746 closes #3743)

Internal Changes

• Drop a Legacy pre-commit.ci Configuration (#3697)
• Add Python 3.12 Beta to the Test Matrix (#3751)
• Use Temporary Files for Testing File Downloads (#3777)
• Auto-Update Changed Version in Other Files After Dependabot PRs (#3716)
• Add More ruff Rules (#3763)
• Rename _handler.py to _basehandler.py (#3761)
• Automatically Label pre-commit-ci PRs (#3713)
• Rework pytest Integration into GitHub Actions (#3776)
• Fix Two Bugs in GitHub Actions Workflows (#3739)

Dependency Updates

• Update cachetools requirement from ~=5.3.0 to ~=5.3.1 (#3738)
• Update aiolimiter requirement from ~=1.0.0 to ~=1.1.0 (#3707)
pre-commit autoupdate (#3791)
• Bump sphinxcontrib-mermaid from 0.8.1 to 0.9.2 (#3737)
• Bump pytest-xdist from 3.2.1 to 3.3.0 (#3705)
• Bump srvaroa/labeler from 1.5.0 to 1.6.0 (#3786)
• Bump dependabot/fetch-metadata from 1.5.1 to 1.6.0 (#3787)
• Bump dessant/lock-threads from 4.0.0 to 4.0.1 (#3785)
• Bump pytest from 7.3.2 to 7.4.0 (#3774)
• Update httpx requirement from ~=0.24.0 to ~=0.24.1 (#3715)
• Bump pytest-xdist from 3.3.0 to 3.3.1 (#3714)
• Bump pytest from 7.3.1 to 7.3.2 (#3758)
pre-commit autoupdate (#3747)
We’ve just released v20.5.
Thank you to everyone who contributed to this release.
As usual, upgrade using pip install -U python-telegram-bot.

This update brings support for Bot API 6.8. Moreover, it removes functionality that was deprecated with the introduction of Bot API 6.5, 6.6 or 6.7. The largest part of this is the renaming of all thumb(_*) arguments and attributes to thumbnail(_*). The removal of this functionality is in line with our stability policy.

Apart from that, this release brings a new argument has_args for CommandHandler as well as the new method Application.stop_running.

For the full list of changes and improvements, please see below.

Major Changes

• API 6.8 (#3853)
• Remove Functionality Deprecated Since Bot API 6.5, 6.6 or 6.7 (#3858)

New Features

• Extend Allowed Values for HTTP Version (#3823 closes #3821)
• Add has_args Parameter to CommandHandler (#3854 by @thatguylah closes #3798)
• Add Application.stop_running() and Improve Marking Updates as Read on Updater.stop() (#3804)

Minor Changes

• Type Hinting Fixes for WebhookInfo (#3871)
• Test and Document Exception.__cause__ on NetworkError (#3792 closes #3778)
• Add Support for Python 3.12 RC (#3847)

Documentation Improvements

• Remove Version Check from Examples (#3846)
• Documentation Improvements (#3803, #3797, #3816 by @trim21, #3829 by @aelkheir)
• Provide Versions of customwebhookbot.py with Different Frameworks (#3820 closes #3717)

Dependency Updates

pre-commit autoupdate (#3824)
• Bump srvaroa/labeler from 1.6.0 to 1.6.1 (#3870)
• Bump sphinx from 7.0.1 to 7.1.1 (#3818)
• Bump sphinx from 7.2.3 to 7.2.5 (#3869)
• Bump furo from 2023.5.20 to 2023.7.26 (#3817)
• Update apscheduler requirement from ~=3.10.3 to ~=3.10.4 (#3862)
• Bump sphinx from 7.2.2 to 7.2.3 (#3861)
• Bump pytest-asyncio from 0.21.0 to 0.21.1 (#3801)
• Bump sphinx-paramlinks from 0.5.4 to 0.6.0 (#3840)
• Update apscheduler requirement from ~=3.10.1 to ~=3.10.3 (#3851)
• Bump furo from 2023.7.26 to 2023.8.19 (#3850)
• Bump sphinx from 7.1.2 to 7.2.2 (#3852)
• Bump sphinx from 7.1.1 to 7.1.2 (#3827)
We’ve just released v20.6.
Thank you to everyone who contributed to this release.
As usual, upgrade using pip install -U python-telegram-bot.

This release brings full support for Bot API 6.9. Moreover, it removes backward compatibility for functionality deprecated in API 6.8. This is in line with our stability policy.

For the full list of changes and improvements, please see the below changelog.

Major Changes

• Drop Backward Compatibility Layer Introduced in #3853 (API 6.8) (#3873)
• Full Support for Bot API 6.9 (#3898)

New Features

• Add Rich Equality Comparison to WriteAccessAllowed (#3911 closes #3909)
• Add __repr__ Methods Added in #3826 closes #3770 to Sphinx Documentation (#3901 closes #3889)
• Add String Representation for Selected Classes (#3826 closes #3770)

Minor Changes

• Add Support Python 3.12 (#3915)
• Documentation Improvements (#3910)

Internal Changes

• Verify Type Hints for Bot Method & Telegram Class Parameters (#3868)
• Move Bot API Tests to Separate Workflow File (#3912)
• Fix Failing file_size Tests (#3906)
• Set Threshold for DeepSource’s PY-R1000 to High (#3888)
• One-Time Code Formatting Improvement via --preview Flag of black (#3882)
• Move Dunder Methods to the Top of Class Bodies (#3883)
• Remove Superfluous Defaults.__ne__ (#3884)

Dependency Updates

pre-commit autoupdate (#3876)
• Update pre-commit Dependencies (#3916)
• Bump actions/checkout from 3 to 4 (#3914)
• Update httpx requirement from ~=0.24.1 to ~=0.25.0 (#3891)
• Bump furo from 2023.8.19 to 2023.9.10 (#3890)
• Bump sphinx from 7.2.5 to 7.2.6 (#3892)
• Update tornado requirement from ~=6.2 to ~=6.3.3 (#3675)
• Bump pytest from 7.4.0 to 7.4.2 (#3881)
We’ve just released v20.7.
Thank you to everyone who contributed to this release.
As usual, upgrade using pip install -U python-telegram-bot.

This release brings support for socket options, a filter for mentions and separate handling of write_timeout for media methods as new features. Moreover, inconsistencies in the handling of the read_timeout parameter for get_updates were fixed.
⚠️ Note that the changes related to timeout behavior come with some deprecations. Please pay attention to the warnings that PTB issues, especially if you have a custom implementation of the BaseRequest class.

For the full list of changes and improvements, please see the below changelog.

New Features

• Add JobQueue.scheduler_configuration and Corresponding Warnings (#3913 closes #3837)
• Add Parameter socket_options to HTTPXRequest (#3935 closes #2965)
• Add ApplicationBuilder.(get_updates_)socket_options (#3943)
• Improve write_timeout Handling for Media Methods (#3952)
• Add filters.Mention (#3941 closes #3799)
• Rename proxy_url to proxy and Allow httpx.{Proxy, URL} as Input (#3939 closes #3844)

Bug Fixes & Changes

• Adjust read_timeout Behavior for Bot.get_updates (#3963 closes #3893)
• Improve BaseHandler.__repr__ for Callbacks without __qualname__ (#3934)
• Fix Persistency Issue with Ended Non-Blocking Conversations (#3962)
• Improve Type Hinting for Arguments with Default Values in Bot (#3942)

Documentation Improvements

• Add Documentation for __aenter__ and __aexit__ Methods (#3907 closes #3886)
• Improve Insertion of Kwargs into Bot Methods (#3965)

Internal Changes

• Adjust Tests to New Error Messages (#3970)

Dependency Updates

• Bump pytest-xdist from 3.3.1 to 3.4.0 (#3975)
pre-commit autoupdate (#3967)
• Update httpx requirement from ~=0.25.1 to ~=0.25.2 (#3983)
• Bump pytest-xdist from 3.4.0 to 3.5.0 (#3982)
• Update httpx requirement from ~=0.25.0 to ~=0.25.1 (#3961)
• Bump srvaroa/labeler from 1.6.1 to 1.7.0 (#3958)
• Update cachetools requirement from ~=5.3.1 to ~=5.3.2 (#3954)
• Bump pytest from 7.4.2 to 7.4.3 (#3953)
We’ve just released v20.8.
Thank you to everyone who contributed to this release.
As usual, upgrade using pip install -U python-telegram-bot.

This release brings full support for Bot API 7.0. A few comments are in order about this.

1️⃣ Bot API 7.0 introduced the classes MaybeInaccessibleMessage and InaccessibleMessage. To check if Message.pinned_message or CallbackQuery.message are usable, it hence no longer suffices to do if message.pinned_message/if callback_query.message. We have overridden MaybeInaccessibleMessage.__bool__ to ease the transition, but highly recommend to manually check your code for compatibility. You can use the helper property MaybeInaccessibleMessage.is_accessible or things like if message.pinned_message is not None/if isinstance(message.pinned_message, Message) instead. Note that Update.effective_message does not return MaybeInaccessibleMessage but only Message.

2️⃣ Constructing the arguments quote_position and quote_entities for the new ReplyParameters can be tedious. We have added helper methods Message.compute_quote_position_and_entities and Message.build_reply_arguments to make life easier for you. Note that to avoid confusion, we have deprecated the argument quote of Message.reply_* in favour of the new argument do_quote.

3️⃣ Due to the renaming of user_shared to users_shared, we deprecated filters.USER_SHARED in favour of the new filters.USERS_SHARED. We're pointing this out here, since accessing filters.USER_SHARED does not issue a warning at runtime.

4️⃣ We faced some difficulties while updating Message.text/caption_markdown/html to the new block quote entities. After contacting Telegram about inconsistencies in the handling of message entities, we were adviced to work with MessageEntity objects directly rather than converting them back into formatted strings as done by Message.text/caption_markdown/html. As these utility properties have been available in PTB for a long time, we have decided to still keep and extend them to new message entity types. However, they will handle only the most common use cases and might not be able to handle all edge cases. We have added corresponding notes to the documentation.

Apart from Bot API related changes, this release adds a parameter pattern to PreCheckoutQueryHandler and adds filters.SuccessfulPayment.
Moreover, to make new Bot API functionality available to you even before we release an update of the library, we have added the new method Bot.do_api_request that allows you to directly call any Bot API method even if it is not yet implemented in the library. Please also have a look at this wiki page on how PTB makes new Bot API functionality available to you.

For the full list of changes and improvements, please see the documentation and below (we just left out dependency updates and internal changes to fit the message length limit).

Major Changes

• API 7.0 (#4034 closes #4033, #4038 by @aelkheir)

Minor Changes

• Fix Type Hint for filters Parameter of MessageHandler (#4039 by @Palaptin)
• Deprecate filters.CHAT (#4083 closes #4062)
• Improve Error Handling in Built-In Webhook Handler (#3987 closes #3979)

New Features

• Add Parameter pattern to PreCheckoutQueryHandler and filters.SuccessfulPayment (#4005 by @aelkheir closes #3752)
• Add Missing Conversions of type to Corresponding Enum from telegram.constants (#4067)
• Add Support for Unix Sockets to Updater.start_webhook (#3986 closes #3978)
• Add Bot.do_api_request (#4084 closes #4053)
• Add AsyncContextManager as Parent Class to BaseUpdateProcessor (#4001)

Documentation Improvements

• Documentation Improvements (#3919)
• Add Docstring to Dunder Methods (#3929 closes #3926)
• Documentation Improvements (#4002, #4079 by @kenjitagawa, #4104 by @xTudoS)
We’ve just released v21.0.
Thank you to everyone who contributed to this release.
As usual, upgrade using pip install -U python-telegram-bot.

This update brings full support for Bot API 7.1. Moreover, it removes backward compatibility for functionality deprecated in API 7.0. This is in line with our stability policy.

Moreover, this update brings a new major version. However, apart from the Bot API related removals, it does not contain any breaking changes and is backwards compatible to v20.x.

The bump of the major version is solely intended to mark that the next step in PTBs development after the introduction of v20.0 in January 2023. Since then, we have been working actively on smoothing out rough edges of v20, which sometimes involved deprecating functionality. To not carry old baggage around forever and ensure that PTB remains maintainable, this deprecated functionality will have to be removed at some point. This version bump brings us closer to that point, while still keeping the promise of a stable user interface that we formalized with our explicit stability policy.

For the full list of changes and improvements, please see below changelog.

Major Changes

• Remove Functionality Deprecated in API 7.0 (#4114 closes #4099)
• API 7.1 (#4118)

New Features

• Add Parameter media_write_timeout to HTTPXRequest and Method ApplicationBuilder.media_write_timeout (#4120 closes #3864)
• Handle Properties in TelegramObject.__setstate__ (#4134 closes #4111)

Bug Fixes

• Add Missing Slot to Updater (#4130 closes #4127)

Documentation Improvements

• Improve HTML Download of Documentation (#4146 closes #4050)
• Documentation Improvements (#4109, #4116)
• Update Copyright to 2024 (#4121 by @aelkheir closes #4041)

Internal Changes

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

Dependency Updates

• Relax Upper Bound for httpx Dependency (#4148)
• Bump test-summary/action from 2.2 to 2.3 (#4142)
• Update cachetools requirement from ~=5.3.2 to ~=5.3.3 (#4141)
• Update httpx requirement from ~=0.26.0 to ~=0.27.0 (#4131)
We’ve just released v21.0.1.
As usual, upgrade using pip install -U python-telegram-bot.

This is a hotfix release for a faulty package configuration.

Bug Fixes

• Remove docs from Package (#4150)
Yesterday the Telegram team released Bot API 7.2. This update brings many changes, which we are already working on implementing.

However there is one major backward incompatible change, which is the removal of the fields StickerSet.is_animated/is_video. This unfortunately breaks the method Bot.get_sticker_set and affects all versions of our library. The current workaround for this if you have v20.8+ is to directly call
await bot.do_api_request("get_sticker_set", {"name": sticker_set_name})
and parse the resulting JSON return value. The upcoming version of the library will address this incompatibility.

Thank you for understanding and being patient.
We’ve just released v21.1.
Thank you to everyone who contributed to this release.
As usual, upgrade using pip install -U python-telegram-bot.

This update brings full support for Bot API 7.2. Moreover, it removes backward compatibility for functionality deprecated in API 7.1. This is in line with our stated policy

⚠️ Please note that the Bot API update includes breaking changes for Bot.set_sticker_set_thumbnail, InputSticker and StickerSet. See also our earlier post and this GitHub thread for additional information.
To integrate the Bot API changes well into the PTB framework, the Message.repl_* methods now also automatically pass the new business_connection_id parameter and the Update.effective_* properties consider the new update types as well.

Another change for the Message.reply_* methods is they now reply in the same topic by default.

For the full list of changes and improvements, please see the below changelog.

Major Changes

• API 7.2 (#4180 closes #4179 and #4181, #4181)
• Make ChatAdministratorRights/ChatMemberAdministrator.can_*_stories Required (API 7.1) (#4192)

Minor Changes

• Refactor Debug logging in Bot to Improve Type Hinting (#4151 closes #4010)

New Features

• Make Message.reply_* Reply in the Same Topic by Default (#4170 by @aelkheir closes #4139)
• Accept Socket Objects for Webhooks (#4161 closes #4078)
• Add Update.effective_sender (#4168 by @aelkheir closes #4085)

Documentation Improvements

• Documentation Improvements (#4171, #4158 by @teslaedison)

Internal Changes

• Temporarily Mark Tests with get_sticker_set as XFAIL due to API 7.2 Update (#4190)

Dependency Updates

pre-commit autoupdate (#4184)
• Bump dependabot/fetch-metadata from 1.6.0 to 2.0.0 (#4185)
We’ve just released v21.1.1.
Thank you to everyone who contributed to this release.
As usual, upgrade using pip install -U python-telegram-bot.

This is a bug fix release. It addresses a bug that was introduced in v21.1 in the new default behavior of the message_thread_id parameter of the shortcut methods Message.reply_*. Moreover, it’s now ensured that passing message_thread_id=None actually overrides the default behavior.

Bug Fixes

• Fix Bug With Parameter message_thread_id of Message.reply_* (#4207 closes #4205)

Minor Changes

• Remove Deprecation Warning in JobQueue.run_daily (#4206 by @Konano)
• Fix Annotation of EncryptedCredentials.decrypted_secret (#4199 by @marinelay closes #4198)
We've just released v21.2.
Thank you to everyone who contributed to this release.
As usual, upgrade using pip install -U python-telegram-bot.

This release brings full support for the new Bot API 7.3. Moreover, it removes backward compatibility for functionality deprecated in API 7.2. This is in line with our stated policy.
Moreover, it includes improvements for the startup and shutdown behavior of Application.

For the full list of changes and improvements, please see the below changelog.

Major Changes

• Full Support for Bot API 7.3 (#4246, #4260, #4243, #4248, #4242 closes #4236, #4247 by aelkheir)
• Remove Functionality Deprecated by Bot API 7.2 (#4245)

New Features

• Add Version to PTBDeprecationWarning (#4262 closes #4261)
• Handle Exceptions in building CallbackContext (#4222)

Bug Fixes

• Call Application.post_stop Only if Application.stop was called (#4211 closes #4210)
• Handle SystemExit raised in Handlers (#4157 closes #4155 and #4156)
• Make Birthdate.to_date Return a datetime.date Object (#4251)

Documentation Improvements

• Documentation Improvements (#4217)

Internal Changes

• Add New Rules to ruff Config (#4250)
• Adapt Test Suite to Changes in Error Messages (#4238)

Dependency Updates

• Bump furo from 2024.4.27 to 2024.5.6 (#4252)
pre-commit autoupdate (#4239)
• Bump pytest from 8.1.1 to 8.2.0 (#4231)
• Bump dependabot/fetch-metadata from 2.0.0 to 2.1.0 (#4228)
• Bump pytest-asyncio from 0.21.1 to 0.21.2 (#4232)
• Bump pytest-xdist from 3.6.0 to 3.6.1 (#4233)
• Bump furo from 2024.1.29 to 2024.4.27 (#4230)
• Bump srvaroa/labeler from 1.10.0 to 1.10.1 (#4227)
• Bump pytest from 7.4.4 to 8.1.1 (#4218)
• Bump sphinx from 7.2.6 to 7.3.7 (#4215)
• Bump pytest-xdist from 3.5.0 to 3.6.0 (#4215)
Hi all.

We have decided to deprecate the python-telegram-bot-raw library and no longer provide updates for it.

In Februrary 2021, we introduced the library python-telegram-bot-raw that provides the telegram module without telegram.ext. Back then, we felt this to be right thing to do since the rather new v13 had introduced additional required dependencies for the JobQueue.

Since then, v20 has seen the light of day. With v20, python-telegram-bot only has a single required dependency, httpx, for the networking backend. All other dependencies for opt-in functionality of telegram.ext are purely optional. Moreover, according to the numbers that we are aware of ([1], [2], [3], [4]), the python-telegram-bot-raw library never gained a considerable user base compared to python-telegram-bot.

Since maintaining python-telegram-bot-raw still consumes some resources and is currently also hindering the modernization of PTBs packaging setup, we have therefore made this decision. The next release of PTB will add a corresponding warning to python-telegram-bot-raw. This will be the last update for python-telegram-bot-raw.

What does this mean to you?

Almost nothing. All you have to do is remove that trailing -raw from your requirements file. That's it. No code changes are necessary, since python-telegram-bot-raw is a subset of python-telegram-bot. No additional dependencies will be installed.

Thank you for your understanding and your continued usage and support of the python-telegram-bot library.
Your PTB Developer Team
We've just released v21.3.
Thank you to everyone who contributed to this release.
As usual, upgrade using pip install -U python-telegram-bot.

This release brings full support for the new Bot API 7.4. Moreover, it removes backward compatibility for functionality deprecated in Bot API 7.3. This is in line with our stability policy.

As announced previously, this is also the last update for the python-telegram-bot-raw library. It will not receive any further updates. Please switch to using python-telegram-bot.

For the full list of changes and improvements, please see the below changelog.

Major Changes

• Full Support for Bot API 7.4 (#4286, #4280, #4285, #4276 closes #4275, #4283, #4278, #4279)
• Deprecate python-telegram-bot-raw (#4270)
• Remove Functionality Deprecated in Bot API 7.3 (#4266 closes #4244)

New Features

• Add Parameter chat_id to ChatMemberHandler (#4290 by uniquetrij closes #4287)

Documentation Improvements

• Documentation Improvements (#4264 closes #4240)

Internal Changes

• Add setuptools to requirements-dev.txt (#4282)
• Update Settings for pre-commit.ci (#4265)

Dependency Updates

• Bump pytest from 8.2.0 to 8.2.1 (#4272)
We've just released v21.4.
Thank you to everyone who contributed to this release.
As usual, upgrade using pip install -U python-telegram-bot.

This release brings support for Bot API versions 7.5, 7.6, and 7.7.
Moreover, we have added initial support for Python 3.13 Beta and a new convenience helper for working with MessageEntity objects containing UTF-16 encoded characters.

For the full list of changes and improvements, please see the below changelog.

Major Changes

• Full Support for API 7.5 (#4328, #4316, #4315, #4312 closes #4310, #4311)
• Full Support for API 7.6 (#4333 closes #4331, #4344, #4341, #4334, #4335, #4351, #4342, #4348)
• Full Support for API 7.7 (#4356 closes #4355)
• Drop python-telegram-bot-raw And Switch to pyproject.toml Based Packaging (#4288 closes #4129 and #4296)
• Deprecate Inclusion of successful_payment in Message.effective_attachment (#4365 closes #4350)

New Features

• Add Support for Python 3.13 Beta (#4253)
• Add filters.PAID_MEDIA (#4357)
• Log Received Data on Deserialization Errors (#4304)
• Add MessageEntity.adjust_message_entities_to_utf_16 Utility Function (#4323 by Antares0982 closes #4319)
• Make Argument bot of TelegramObject.de_json Optional (#4320)

Documentation Improvements

• Documentation Improvements (#4303 closes #4301)
• Restructure Readme (#4362)
• Fix Link-Check Workflow (#4332)

Internal Changes

• Automate PyPI Releases (#4364 closes #4318)
• Add mise-en-place to .gitignore (#4300)
• Use a Composite Action for Testing Type Completeness (#4367)
• Stabilize Some Concurrency Usages in Test Suite (#4360)
• Add a Test Case for MenuButton (#4363)
• Extend SuccessfulPayment Test (#4349)
• Small Fixes for test_stars.py (#4347)
• Use Python 3.13 Beta 3 in Test Suite (#4336)

Dependency Updates

• Bump ruff and Add New Rules (#4329)
• Bump pre-commit Hooks to Latest Versions (#4337)
• Add Lower Bound for flaky Dependency (#4322 by Palaptin)
• Bump pytest from 8.2.1 to 8.2.2 (#4294)
We've just released v21.5.
Thank you to everyone who contributed to this release.
As usual, upgrade using pip install -U python-telegram-bot.

This release brings support for Bot API 7.8 and 7.9. The new parameter read_file_handle of InputFile was added to support special use cases with local API servers. Moreover, building up on v21.4, additional convenience methods for MessageEntity were added.

Finally, we would like to point out that Python 3.8 will be reaching its end of life some time in October. python-telegram-bot will drop support for Python 3.8 after that. If you're still using Python 3.8, please consider upgrading to a newer version.

For the full list of changes and improvements, please see the below changelog.

Major Changes

• Full Support for Bot API 7.9 (#4429)
• Full Support for Bot API 7.8 (#4408)

New Features

• Add MessageEntity.shift_entities and MessageEntity.concatenate (#4376 closes #4372)
• Add Parameter game_pattern to CallbackQueryHandler (#4353 by jainamoswal closes #4269)
• Add Parameter read_file_handle to InputFile (#4388 closes #4339)

Documentation Improvements

• Bugfix for "Available In" Admonitions (#4413)
• Documentation Improvements (#4400 closes #4446, #4448 by Palaptin)
• Document Return Types of RequestData Members (#4396)
• Add Introductory Paragraphs to Telegram Types Subsections (#4389 by mohdyusuf2312 closes #4380)
• Start Adapting to RTD Addons (#4386)

Minor and Internal Changes

• Remove Surplus Logging from Updater Network Loop (#4432 by MartinHjelmare)
• Add Internal Constants for Encodings (#4378 by elpekenin)
• Improve PyPI Automation (#4375 closes #4373)
• Update Test Suite to New Test Channel Setup (#4435)
• Improve Fixture Usage in test_message.py (#4431 by Palaptin)
• Update Python 3.13 Test Suite to RC1 (#4415)
• Bump ruff and Add New Rules (#4416)

Dependency Updates

• Update cachetools requirement from <5.5.0,>=5.3.3 to >=5.3.3,<5.6.0 (#4437)
• Bump sphinx from 7.4.7 to 8.0.2 and furo from 2024.7.18 to 2024.8.6 (#4412)
• Bump test-summary/action from 2.3 to 2.4 (#4410)
• Bump pytest from 8.2.2 to 8.3.2 (#4403)
• Bump dependabot/fetch-metadata from 2.1.0 to 2.2.0 (#4411)
• Update cachetools requirement from ~=5.3.3 to >=5.3.3,<5.5.0 (#4390)
• Bump sphinx from 7.3.7 to 7.4.7 (#4395)
• Bump furo from 2024.5.6 to 2024.7.18 (#4392)
We've just released v21.6.
Thank you to everyone who contributed to this release.
As usual, upgrade using pip install -U python-telegram-bot.

This release brings support for Bot API 7.10 and allows further customization of HTTPXRequest.

For the full list of changes and improvements, please see the below changelog.

New Features

• Full Support for Bot API 7.10 (#4461 closes #4459, #4460, #4463 by aelkheir, #4464)
• Add Parameter httpx_kwargs to HTTPXRequest (#4451 closes #4424)

Minor Changes

• Improve Type Completeness (#4466)

Internal Changes

• Update Python 3.13 Test Suite to RC2 (#4471)
• Enforce the offline_bot Fixture in Test*WithoutRequest (#4465)
• Make Tests for telegram.ext Independent of Networking (#4454)
• Rename Testing Base Classes (#4453)

Dependency Updates

• Bump pytest from 8.3.2 to 8.3.3 (#4475)
We've just released v21.7.
Thank you to everyone who contributed to this release.
As usual, upgrade using pip install -U python-telegram-bot.

This release brings full support for Bot API 7.11.
Moreover, it removes support for Python 3.8, which reached EOL on September 6th, 2024 and adds stable support for Python 3.13.
This is in line with our stability policy.

For the full list of changes and improvements, please see the below changelog.

Major Changes

• Full Support for Bot API 7.11 (#4546 closes #4543)
• Add Message.reply_paid_media (#4551)
• Drop Support for Python 3.8 (#4398 by elpekenin)

Minor Changes

• Allow Sequence in Application.add_handlers (#4531 by roast-lord closes #4530)
• Improve Exception Handling in File.download_* (#4542)
• Use Stable Python 3.13 Release in Test Suite (#4535)

Documentation Improvements

• Documentation Improvements (#4536 by Ecode2, #4556)
• Fix Linkcheck Workflow (#4545)
• Use sphinx-build-compatibility to Keep Sphinx Compatibility (#4492)

Internal Changes

• Improve Test Instability Caused by Message Fixtures (#4507)
• Stabilize Some Flaky Tests (#4500)
• Reduce Creation of HTTP Clients in Tests (#4493)
• Update pytest-xdist Usage (#4491)
• Fix Failing Tests by Making Them Independent (#4494)
• Introduce Codecov's Test Analysis (#4487)
• Maintenance Work on Bot Tests (#4489)
• Introduce conftest.py for File Related Tests (#4488)
• Update Issue Templates to Use Issue Types (#4553)
• Update Automation to Label Changes (#4552)

Dependency Updates

• Bump srvaroa/labeler from 1.11.0 to 1.11.1 (#4549)
• Bump sphinx from 8.0.2 to 8.1.3 (#4532)
• Bump sphinxcontrib-mermaid from 0.9.2 to 1.0.0 (#4529)
• Bump srvaroa/labeler from 1.10.1 to 1.11.0 (#4509)
• Bump Bibo-Joshi/pyright-type-completeness from 1.0.0 to 1.0.1 (#4510)
We've just released v21.8.
Thank you to everyone who contributed to this release.
As usual, upgrade using pip install -U python-telegram-bot.

For the full list of changes and improvements, please see the below changelog.

Major Changes

• Full Support for Bot API 8.0 (#4568, #4566 closes #4567, #4572, #4571, #4570, #4576, #4574)

Documentation Improvements

• Documentation Improvements (#4565 by Snehashish06, #4573)
We've just released v21.9.
Thank you to everyone who contributed to this release.
As usual, upgrade using pip install -U python-telegram-bot.

For the full list of changes and improvements, please see the below changelog.

Major Changes

• Full Support for Bot API 8.1 (#4594 closes #4592)

Minor Changes

• Use MessageLimit.DEEP_LINK_LENGTH in helpers.create_deep_linked_url (#4597 by nemacysts)
• Allow Sequence Input for allowed_updates in Application and Updater Methods (#4589 by nemacysts)

Dependency Updates

• Update aiolimiter requirement from ~=1.1.0 to >=1.1,<1.3 (#4595)
• Bump pytest from 8.3.3 to 8.3.4 (#4596)
• Bump codecov/codecov-action from 4 to 5 (#4585)
• Bump pylint to v3.3.2 to Improve Python 3.13 Support (#4590 by nemacysts)
• Bump srvaroa/labeler from 1.11.1 to 1.12.0 (#4586)
We've just released v21.10.
Thank you to everyone who contributed to this release.
As usual, upgrade using pip install -U python-telegram-bot.

This release brings full support for Bot API 8.2 and includes a bug fix for the deserialization of Gift and Gifts.
Moreover, with the update of the optional apscheduler dependency used for the JobQueue, we have deprecated support for pytz timezones.
Please switch to using zoneinfo.ZoneInfo timezones after upgrading.

For the full list of changes and improvements, please see the below changelog.

Major Changes

• Full Support for Bot API 8.2 (#4633)
• Bump apscheduler & Deprecate pytz Support (#4582)

New Features

• Add Parameter pattern to JobQueue.jobs() (#4613 closes #4544)
• Allow Input of Type Sticker for Several Methods (#4616 closes #4580)

Bug Fixes

• Ensure Forward Compatibility of Gift and Gifts (#4634 closes #4637)

Documentation Improvements & Internal Changes

• Use Custom Labels for dependabot PRs (#4621)
• Remove Redundant pylint Suppressions (#4628)
• Update Copyright to 2025 (#4631)
• Refactor Module Structure and Tests for Star Payments Classes (#4615 closes #4593)
• Unify datetime Imports (#4605 by @cuevasrja closes #4577)
• Add Static Security Analysis of GitHub Actions Workflows (#4606)

Dependency Updates

• Bump astral-sh/setup-uv from 4.2.0 to 5.1.0 (#4625)
• Bump codecov/codecov-action from 5.1.1 to 5.1.2 (#4622)
• Bump actions/upload-artifact from 4.4.3 to 4.5.0 (#4623)
• Bump github/codeql-action from 3.27.9 to 3.28.0 (#4624)