Skip to content
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

Avoid importing contextlib in _virtualenv #2688

Merged
merged 3 commits into from
Feb 21, 2024
Merged

Conversation

hauntsaninja
Copy link
Contributor

@hauntsaninja hauntsaninja commented Feb 6, 2024

This appears to be imported in a .pth file, so this file runs in basically every Python program in my environment. contextlib takes about 3ms to import and I'd prefer to not pay that cost if not strictly necessary.

Thanks for contributing, make sure you address all the checklists (for details on how see development documentation)

  • ran the linter to address style issues (tox -e fix)
  • wrote descriptive pull request text
  • [] ensured there are test(s) validating the fix
  • added news fragment in docs/changelog folder
  • [] updated/extended the documentation

@hauntsaninja
Copy link
Contributor Author

This was introduced in #2588 , presumably as part of a mass application of SIM105

@hauntsaninja
Copy link
Contributor Author

Looks like tests are failing on #2685 as well...

@hauntsaninja
Copy link
Contributor Author

(Also noob question: what is the os.path.join(__file__) idiom meant to do?)

@gaborbernat
Copy link
Contributor

(Also noob question: what is the os.path.join(__file__) idiom meant to do?)

Probably a no-op, could try removing it.

hauntsaninja added a commit to hauntsaninja/uv that referenced this pull request Feb 16, 2024
No need to pay 3ms on basically every Python invocation.
I opened a PR upstream last week: pypa/virtualenv#2688
charliermarsh pushed a commit to astral-sh/uv that referenced this pull request Feb 16, 2024
No need to pay 3ms on basically every Python invocation. I opened a PR
upstream last week: pypa/virtualenv#2688
hauntsaninja and others added 3 commits February 21, 2024 13:19
This appears to be imported in a `.pth` file, so this file runs in basically every Python program in my environment. contextlib takes about 3ms to import and I'd prefer to not pay that cost if not strictly necessary.
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
@gaborbernat gaborbernat merged commit e72dea8 into pypa:main Feb 21, 2024
47 checks passed
@hauntsaninja hauntsaninja deleted the patch-1 branch February 21, 2024 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants