Skip to content

GH-77621: Delay some imports from pathlib #112244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 25, 2023

Conversation

barneygale
Copy link
Contributor

@barneygale barneygale commented Nov 18, 2023

Import contextlib, glob and re only as required.

Import `contextlib`, `glob` and `re` only as required.
@barneygale barneygale marked this pull request as ready for review November 21, 2023 03:00
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cuts >50% off the import time for me locally, which is fantastic! Definitely worth doing -- I left some thoughts above about the particulars :)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it!

@barneygale
Copy link
Contributor Author

Thank you very much :)

@barneygale barneygale enabled auto-merge (squash) November 25, 2023 17:28
@barneygale barneygale merged commit bbb4367 into python:main Nov 25, 2023
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
Import `contextlib`, `glob` and `re` only as required.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
Import `contextlib`, `glob` and `re` only as required.

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance or resource usage topic-pathlib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants