pypa / virtualenv

Virtual Python Environment builder
https://virtualenv.pypa.io
MIT License
4.8k stars 1.03k forks source link

Avoid importing contextlib in `_virtualenv` #2688

Closed hauntsaninja closed 6 months ago

hauntsaninja commented 7 months ago

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)

hauntsaninja commented 7 months ago

This was introduced in https://github.com/pypa/virtualenv/pull/2588 , presumably as part of a mass application of SIM105

hauntsaninja commented 7 months ago

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

hauntsaninja commented 7 months ago

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

gaborbernat commented 7 months ago

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

Probably a no-op, could try removing it.