GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Use lazy modules to reduce import time on 3.15+ by harshil21 · Pull Request #5377 · python-telegram-bot/python-telegram-bot

Conversation

@harshil21

@harshil21 harshil21 commented Oct 11, 2026

Copy link
Copy Markdown
Member

Pass 2 of making lazy imports a reality on 3.15+ (Pass 1: #5231).

Seems like AI was able to reduce the import time which I couldn't quite do on my first pass on this a few months ago:

Import Before After
telegram 126.8 ms 26.3 ms
telegram.ext 142.8 ms 26.4 ms

Also made it add a pre-commit hook for maintaining the __lazy_imports__: It adds missing entries, removes stale ones, sorts and deduplicates both lists.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
harshil21 added 6 commits October 10, 2026 13:27
@harshil21
Remove support for Python 3.10
4825f7a
@harshil21
Merge master and fix conflicts
fb60413
@harshil21 @github-actions
Add chango fragment for PR #5374
0c5832b
@harshil21
ignore false positive
79fe223
@harshil21
update changlog
aefa765
@harshil21
Use lazy modules to reduce import time on 3.15+
68787cf
@harshil21 harshil21 added the 🔌 enhancement pr description: enhancement label Oct 11, 2026
@harshil21
harshil21 added this pull request to stack #5378 October 11, 2026 04:04
harshil21 added 3 commits October 10, 2026 21:11
@harshil21
Merge branch 'master' into py315
d3e1204
@harshil21
Merge branch 'py315' into lazy-imports-v2
6e780dd
@harshil21
Fix test for 3.15
8a06dd9
Base automatically changed from py315 to master October 19, 2026 01:17

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

🔌 enhancement pr description: enhancement

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@harshil21
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.