Skip to content

Defer the psutil import until it is actually needed - #1551

Open
Carreau wants to merge 1 commit into
ipython:mainfrom
Carreau:lazy-psutil
Open

Defer the psutil import until it is actually needed#1551
Carreau wants to merge 1 commit into
ipython:mainfrom
Carreau:lazy-psutil

Conversation

@Carreau

@Carreau Carreau commented Sep 3, 2026

Copy link
Copy Markdown
Member

psutil is optional and its import is not cheap, yet it was paid for on every kernel startup even though most sessions never ask for usage information or need to enumerate child processes.

It is now imported through _get_psutil(), which caches the (possibly None) result on first use.

psutil is optional and its import is not cheap, yet it was paid for on
every kernel startup even though most sessions never ask for usage
information or need to enumerate child processes.

It is now imported through `_get_psutil()`, which caches the (possibly
None) result on first use.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant