Skip to main content

Module python_tools

Module python_tools 

Source
Expand description

The Python tools an app favours without shipping them: uv (environments, running scripts), ruff (format, lint) and ty (types). Each is found, picked at another path, or off (Choice); $UV, $RUFF and $TY win over the choice, as $UV always has. The choices are one PythonTools, kept in a file the app names (load, save; JSON, read and written whole) and set for the process with set_current, so every part of the app finds the same tools (find). Nothing here installs a tool: a missing one is reported with its install page.

A project’s own pyproject.toml / ruff.toml configure the tools; the app only picks them.

Structs§

PythonTools
The app’s Python tools and what they do.

Enums§

Choice
How a tool is picked.
PyTool
One of the tools.
Status
What the Settings row of tool says: its program and version, or why there is none.

Functions§

current
The process’s choices (the defaults until set_current).
find
tool’s program with the process’s choices: $<TOOL> first, then the choice.
find_with
tool‘s program with tools’ choice ($<TOOL> still first).
found
Where tool is when nothing picks it: the PATH, then where its installer puts it.
load
The choices kept at path (the defaults when there is no file yet or it cannot be read).
save
Keeps tools at path.
set_current
Sets the process’s choices (the app, after loading them or when Settings change).
status
tool‘s status with tools’ choices (runs --version: call it off the UI thread).
version
program --version’s first line (ruff 0.14.2); None when it does not run.