Skip to content

Commit a16f609

Browse files
authored
fix 20ms startup penalty added by virtualenv (#2317)
1 parent d865c3e commit a16f609

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

docs/changelog/2317.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improve performance of python startup inside created virtualenvs - by :user:`asottile`.

docs/changelog/examples.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
33
file ``544.doc.rst``::
44

5-
explain everything much better - by ``passionate_technicalwriter``
5+
explain everything much better - by :user:`passionate_technicalwriter`.
66

77
file ``544.feature.rst``::
88

9-
``tox --version`` now shows information about all registered plugins - by ``obestwalter``
9+
``tox --version`` now shows information about all registered plugins - by :user:`obestwalter`.
1010

1111

1212
file ``571.bugfix.rst``::
1313

1414
``skip_install`` overrides ``usedevelop`` (``usedevelop`` is an option to choose the
1515
installation type if the package is installed and ``skip_install`` determines if it should be
16-
installed at all) - by ``ferdonline``
16+
installed at all) - by :user:`ferdonline`.
1717

1818
.. see pyproject.toml for all available categories

src/virtualenv/create/via_global_ref/_virtualenv.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,8 @@ def parse_config_files(self, *args, **kwargs):
3737
_DISTUTILS_PATCH = "distutils.dist", "setuptools.dist"
3838
if sys.version_info > (3, 4):
3939
# https://docs.python.org/3/library/importlib.html#setting-up-an-importer
40-
from functools import partial
41-
from importlib.abc import MetaPathFinder
42-
from importlib.util import find_spec
4340

44-
class _Finder(MetaPathFinder):
41+
class _Finder:
4542
"""A meta path finder that allows patching the imported distutils modules"""
4643

4744
fullname = None
@@ -65,6 +62,9 @@ def find_spec(self, fullname, path, target=None):
6562
# https://docs.python.org/3/faq/library.html#what-kinds-of-global-value-mutation-are-thread-safe
6663
self.lock.append(lock)
6764

65+
from functools import partial
66+
from importlib.util import find_spec
67+
6868
with self.lock[0]:
6969
self.fullname = fullname
7070
try:

0 commit comments

Comments
 (0)