mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-04 20:26:53 +00:00
Defer setuptools import to save ~60ms on startup
(I ran this 5 times and picked a median result) ### before ```console $ time flake8 --help > /dev/null real 0m0.221s user 0m0.199s sys 0m0.020s ``` ### after ```console $ time flake8 --help > /dev/null real 0m0.169s user 0m0.144s sys 0m0.020s ```
This commit is contained in:
parent
9631dac52a
commit
6a610cb5d6
1 changed files with 3 additions and 2 deletions
|
|
@ -4,8 +4,6 @@ from __future__ import print_function
|
|||
import json
|
||||
import platform
|
||||
|
||||
import setuptools
|
||||
|
||||
|
||||
def print_information(option, option_string, value, parser,
|
||||
option_manager=None):
|
||||
|
|
@ -65,4 +63,7 @@ def plugins_from(option_manager):
|
|||
|
||||
def dependencies():
|
||||
"""Generate the list of dependencies we care about."""
|
||||
# defer this expensive import, not used outside --bug-report
|
||||
import setuptools
|
||||
|
||||
return [{'dependency': 'setuptools', 'version': setuptools.__version__}]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue