René's URL Explorer Experiment


Title: Improve import time of various stdlib modules · Issue #118761 · python/cpython · GitHub

Open Graph Title: Improve import time of various stdlib modules · Issue #118761 · python/cpython

X Title: Improve import time of various stdlib modules · Issue #118761 · python/cpython

Description: Feature or enhancement Proposal: Following on from #109653, further improvements can be made to import times. Links to previous discussion of this feature: https://discuss.python.org/t/deferred-computation-evalution-for-toplevels-imports...

Open Graph Description: Feature or enhancement Proposal: Following on from #109653, further improvements can be made to import times. Links to previous discussion of this feature: https://discuss.python.org/t/deferred-com...

X Description: Feature or enhancement Proposal: Following on from #109653, further improvements can be made to import times. Links to previous discussion of this feature: https://discuss.python.org/t/deferred-com...

Opengraph URL: https://github.com/python/cpython/issues/118761

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Improve import time of various stdlib modules","articleBody":"# Feature or enhancement\r\n\r\n### Proposal:\r\n\r\nFollowing on from https://github.com/python/cpython/issues/109653, further improvements can be made to import times.\r\n\r\n### Links to previous discussion of this feature:\r\n\r\nhttps://discuss.python.org/t/deferred-computation-evalution-for-toplevels-imports-and-dataclasses/34173\r\n\r\n### For example:\r\n\r\n`importlib.metadata` is often used for tasks that need to happen at import, e.g. to enumerate/load entry point plug-ins, so it might be worth seeing if we can cut down its own import time a bit more.\r\n\r\n`importlib.metadata` imports `zipfile` at the top for a function that won't be called in the vast majority of cases.  It also imports `importlib.abc`, which in turn imports `importlib.resources`, to subclass an ABC with a single, non-abstract method - I assume redefining the method in `importlib.metadata` would be harmless.  Some other less frequently-used imports which are only accessed once or twice, such as `json`, could also be tucked away in their calling functions.\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-122725\n* gh-123520\n* gh-121424\n* gh-126979\n* gh-128732\n* gh-128736\n* gh-128738\n* gh-128858\n* gh-128898\n* gh-128899\n* gh-128907\n* gh-128981\n* gh-129118\n* gh-129427\n* gh-129428\n* gh-129447\n* gh-129448\n* gh-129765\n* gh-129811\n* gh-129860\n* gh-129925\n* gh-130056\n* gh-130201\n* gh-130204\n* gh-130205\n* gh-131796\n* gh-131953\n* gh-131956\n* gh-132024\n* gh-132025\n* gh-132028\n* gh-132031\n* gh-132035\n* gh-132036\n* gh-132037\n* gh-132046\n* gh-132059\n* gh-132060\n* gh-132103\n* gh-132614\n* gh-133057\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/layday","@type":"Person","name":"layday"},"datePublished":"2024-05-08T13:13:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":71},"url":"https://github.com/118761/cpython/issues/118761"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:239dc11e-5b3e-f4cc-4678-ae838adf81fe
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD6BA:2D0DCE:702A2:9A144:696962E2
html-safe-nonce29eeaaf6a9546ec5e5af58810ce61892ee274f079f26d15d0d8200e5e9994abd
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENkJBOjJEMERDRTo3MDJBMjo5QTE0NDo2OTY5NjJFMiIsInZpc2l0b3JfaWQiOiI1ODc1MDc4NjkyMTU1Nzc3NzYyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac3af456fd647243f8a7f70f4a6f252f56f71a97ce4943afd97f947499ba2fa7ad
hovercard-subject-tagissue:2285570381
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/118761/issue_layout
twitter:imagehttps://opengraph.githubassets.com/17b571672495cd1a315e85a9b64d8bf0a450203ae0cc58e40b2dfc74f09450bc/python/cpython/issues/118761
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/17b571672495cd1a315e85a9b64d8bf0a450203ae0cc58e40b2dfc74f09450bc/python/cpython/issues/118761
og:image:altFeature or enhancement Proposal: Following on from #109653, further improvements can be made to import times. Links to previous discussion of this feature: https://discuss.python.org/t/deferred-com...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamelayday
hostnamegithub.com
expected-hostnamegithub.com
None48487c1ad776a7975b7132d95f4240ff3ae37cd5b8e3cb597102a4edb76738f1
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release669463fcc54773a88c1f5a44eef6b99a5504b9c7
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/118761#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F118761
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F118761
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/118761
Reloadhttps://github.com/python/cpython/issues/118761
Reloadhttps://github.com/python/cpython/issues/118761
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/118761
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/issues/118761
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/118761
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/118761
Improve import time of various stdlib moduleshttps://github.com/python/cpython/issues/118761#top
performancePerformance or resource usagehttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22performance%22
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
topic-importlibhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-importlib%22
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
https://github.com/layday
https://github.com/layday
laydayhttps://github.com/layday
on May 8, 2024https://github.com/python/cpython/issues/118761#issue-2285570381
#109653https://github.com/python/cpython/issues/109653
https://discuss.python.org/t/deferred-computation-evalution-for-toplevels-imports-and-dataclasses/34173https://discuss.python.org/t/deferred-computation-evalution-for-toplevels-imports-and-dataclasses/34173
gh-118761: Improve import time of pprint #122725https://github.com/python/cpython/pull/122725
gh-118761: Speedup pathlib import by deferring shutil #123520https://github.com/python/cpython/pull/123520
gh-121423: Improve import time of socket by writing socket.errorTab as a constant and lazy import modules #121424https://github.com/python/cpython/pull/121424
gh-118761: Improve import time of mimetypes #126979https://github.com/python/cpython/pull/126979
gh-118761: improve import time for pickle #128732https://github.com/python/cpython/pull/128732
gh-118761: substitute re import in base64.b16decode for a more efficient alternative #128736https://github.com/python/cpython/pull/128736
gh-118761: improve import time for secrets #128738https://github.com/python/cpython/pull/128738
gh-118761: Improve import time for csv #128858https://github.com/python/cpython/pull/128858
gh-118761: Reduce import time of gettext.py by delaying re import #128898https://github.com/python/cpython/pull/128898
gh-118761: improve optparse import time by delaying textwrap import #128899https://github.com/python/cpython/pull/128899
gh-118761: Improve import time of tomllib #128907https://github.com/python/cpython/pull/128907
gh-118761: Improve import time for pstats and zipfile by removing imports to typing #128981https://github.com/python/cpython/pull/128981
gh-118761: Improve import time of sqlite3 #129118https://github.com/python/cpython/pull/129118
gh-118761: Improve import time of subprocess #129427https://github.com/python/cpython/pull/129427
gh-118761: Always lazy import warnings in threading #129428https://github.com/python/cpython/pull/129428
[3.13] gh-118761: Improve import time of subprocess (GH-129427) #129447https://github.com/python/cpython/pull/129447
[3.12] gh-118761: Improve import time of subprocess (GH-129427) #129448https://github.com/python/cpython/pull/129448
gh-118761: Improve import time by lazy import of warnings #129765https://github.com/python/cpython/pull/129765
gh-118761: Improve import time by lazy import of traceback #129811https://github.com/python/cpython/pull/129811
gh-118761: Always lazy import re in locale #129860https://github.com/python/cpython/pull/129860
gh-118761: Improve import time of dataclasses #129925https://github.com/python/cpython/pull/129925
gh-118761: Improve import time of cmd module #130056https://github.com/python/cpython/pull/130056
gh-118761: Revert "Improve import time of subprocess (GH-129427)" #130201https://github.com/python/cpython/pull/130201
[3.13] gh-118761: Revert "Improve import time of subprocess (GH-129427)" (GH-130201) #130204https://github.com/python/cpython/pull/130204
[3.12] gh-118761: Revert "Improve import time of subprocess (GH-129427)" (GH-130201) #130205https://github.com/python/cpython/pull/130205
gh-137855: Improve import time of sqlite3 #131796https://github.com/python/cpython/pull/131796
gh-118761: Optimise import time for ast #131953https://github.com/python/cpython/pull/131953
gh-137855: Optimise import time for textwrap #131956https://github.com/python/cpython/pull/131956
gh-118761: Fix star-import of ast #132024https://github.com/python/cpython/pull/132024
gh-118761: Fix star-import of ast (alternative) #132025https://github.com/python/cpython/pull/132025
gh-118761: Improve import time of annotationlib #132028https://github.com/python/cpython/pull/132028
gh-118761: Use enum._simple_enum for annotationlib.Format #132031https://github.com/python/cpython/pull/132031
gh-118761: Cover the import time optimisations in What's New #132035https://github.com/python/cpython/pull/132035
gh-118761: Optimise import time for shlex #132036https://github.com/python/cpython/pull/132036
gh-118761: Optimise import time for string #132037https://github.com/python/cpython/pull/132037
gh-137855: email.quoprimime removing re import #132046https://github.com/python/cpython/pull/132046
gh-118761: Defer import of functools in annotationlib #132059https://github.com/python/cpython/pull/132059
gh-118761: Lazily import annotationlib in typing #132060https://github.com/python/cpython/pull/132060
GH-118761: Expose more core interpreter types in _types #132103https://github.com/python/cpython/pull/132103
gh-118761: Add helper to ensure that lazy imports are actually lazy #132614https://github.com/python/cpython/pull/132614
gh-118761: Add test_lazy_import for more modules #133057https://github.com/python/cpython/pull/133057
performancePerformance or resource usagehttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22performance%22
stdlibStandard Library Python modules in the Lib/ directoryhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22stdlib%22
topic-importlibhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22topic-importlib%22
type-featureA feature request or enhancementhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-feature%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.