[BUG] Importing `setuptools` is slow and takes nearly half a second
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
setuptools version
63.1.0
Python version
3.10.5
OS
Windows
Additional environment information
No response
Description
Importing setuptools is slow and takes nearly half a second. This imposes significant performance impact on CLI applications (https://github.com/Azure/azure-cli/issues/23177).
Expected behavior
Importing setuptools should be fast.
How to Reproduce
import setuptools
Output
python -X importtime -c "import setuptools" 2>perf.log ; python -m tuna .\perf.log

Without setuptools, importing distutils is pretty fast:
python -X importtime -c "import distutils" 2>perf.log ; python -m tuna .\perf.log

Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Windows case with python -X importtime -c "import setuptools" and inspect the resulting perf.log with python -m tuna. The issue names no source files or tests; done means identifying and reducing the import-time overhead while preserving the existing setuptools import behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100