Skip to content

Optimize kitty graphics detection on platforms (without psutil support) - #15424

Merged
Carreau merged 5 commits into
ipython:mainfrom
1MLightyears:main
Oct 22, 2026
Merged

Carreau merged 5 commits into
ipython:mainfrom
1MLightyears:main

Conversation

@1MLightyears

Copy link
Copy Markdown
Contributor

E.g. Android/Termux platform can now use /proc/self to find parent shell. psutil is not fully supported on Android/Termux, so it is not a hard dependency on it now.
For platforms that definitely provide no /proc, such as Windows, an early exit is prepared.

Resolves #15422 .

@1MLightyears

1MLightyears commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor Author

As the author of #15419 does not reply, I could only merge main before making any adaptions to other ongoing PRs.

1MLightyears and others added 4 commits October 21, 2026 14:14
E.g. Android/Termux platform can now use `/proc/self` to find parent
shell. psutil is not fully supported on Android/Termux, so it is not
a hard dependency on it now.
For platforms that definitely provide no `/proc`, such as Windows,
an early exit is prepared.
@Carreau
Carreau merged commit d914be8 into ipython:main Oct 22, 2026
25 checks passed
@Carreau Carreau added this to the 9.18 milestone Oct 22, 2026
Carreau pushed a commit that referenced this pull request Nov 2, 2026
Commit b7a6320 (#15424) dropped the import-time evaluation of
supports_kitty_graphics to keep process-tree walks out of startup,
which removed the name from the module namespace; downstream code
such as sagemath still imports it.

Resolve it on access through a PEP 562 module __getattr__ instead:
`from IPython.core.kitty import supports_kitty_graphics` works again
while startup stays free of the detection cost.

Fixes #15460

🤖 This contribution was drafted with AI assistance; the analysis, the change and the tests are described above so that they can be reviewed.

Co-authored-by: Weijian He <230282609+Madin-H23@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid treating psutil as a hard requirement on Termux

2 participants