Title: Support Python 3.15 feature: Lazy imports · Issue #5231 · python-telegram-bot/python-telegram-bot · GitHub
Open Graph Title: Support Python 3.15 feature: Lazy imports · Issue #5231 · python-telegram-bot/python-telegram-bot
X Title: Support Python 3.15 feature: Lazy imports · Issue #5231 · python-telegram-bot/python-telegram-bot
Description: What kind of feature are you missing? Where do you notice a shortcoming of PTB? With the Python 3.15 beta out, we should test if our library can work with the new version without any problems. One of the features we can instantly make us...
Open Graph Description: What kind of feature are you missing? Where do you notice a shortcoming of PTB? With the Python 3.15 beta out, we should test if our library can work with the new version without any problems. One ...
X Description: What kind of feature are you missing? Where do you notice a shortcoming of PTB? With the Python 3.15 beta out, we should test if our library can work with the new version without any problems. One ...
Opengraph URL: https://github.com/python-telegram-bot/python-telegram-bot/issues/5231
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support Python 3.15 feature: Lazy imports","articleBody":"### What kind of feature are you missing? Where do you notice a shortcoming of PTB?\n\nWith the [Python 3.15 beta out](https://blog.python.org/2026/05/python-3150-beta-1/), we should test if our library can work with the new version without any problems.\n\nOne of the features we can instantly make use of is [Lazy Imports](https://peps.python.org/pep-0810/). Currently, importing the `telegram` module takes about 0.25 seconds on my machine with Python 3.14.3.\n\nLazy imports should help cut that down by a little bit at least. \n\n### Describe the solution you'd like\n\n- Add 3.15 runners to the test suite\n- Migrate 3.14t runner to 3.15t runner\n- Use the `__lazy_modules__` feature on our `__init__` files so that the user doesn't have to import objects they won't be using. \n\n### Describe alternatives you've considered\n\nKeep imports inside functions, but that is unpythonic and ugly\n\n### Additional context\n\nWhenever we drop support for 3.14, we can also get rid of our `TYPE_CHECKING` blocks, as that import won't be evaluated at import time, which should also help reduce circular import errors too.","author":{"url":"https://github.com/harshil21","@type":"Person","name":"harshil21"},"datePublished":"2026-05-10T02:11:20Z","url":"https://github.com/python-telegram-bot/python-telegram-bot/issues/5231"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5a099804-0735-453e-741a-fad01cd96512 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 880E:12AC18:1F8DA1:291713:6B029FE2 |
| html-safe-nonce | 8caad3fbf51beb5e49a5203bd92a5ecb7570e7ba27804254090891ed7d375026 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODBFOjEyQUMxODoxRjhEQTE6MjkxNzEzOjZCMDI5RkUyIiwidmlzaXRvcl9pZCI6IjY5Njk0NDM3MjUwNzIzMTAyNDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 155c43bd91efb5d298b0bcd1516b100db57e3eca591016af464c066fe677e4e1 |
| hovercard-subject-tag | issue:4414381401 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-telegram-bot/python-telegram-bot/5231/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5a5ea79d4ad0e865764b96f1573dca1b82406062eb1a67381876e51decfee21b/python-telegram-bot/python-telegram-bot/issues/5231 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5a5ea79d4ad0e865764b96f1573dca1b82406062eb1a67381876e51decfee21b/python-telegram-bot/python-telegram-bot/issues/5231 |
| og:image:alt | What kind of feature are you missing? Where do you notice a shortcoming of PTB? With the Python 3.15 beta out, we should test if our library can work with the new version without any problems. One ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | harshil21 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-telegram-bot/python-telegram-bot git https://github.com/python-telegram-bot/python-telegram-bot.git |
| octolytics-dimension-user_id | 16178365 |
| octolytics-dimension-user_login | python-telegram-bot |
| octolytics-dimension-repository_id | 38696925 |
| octolytics-dimension-repository_nwo | python-telegram-bot/python-telegram-bot |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 38696925 |
| octolytics-dimension-repository_network_root_nwo | python-telegram-bot/python-telegram-bot |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width