Console
console
Resolution of console scripts installed alongside the running interpreter.
shutil.which("axm") answers only when the environment happens to be on
PATH: true under uv run, false when a suite is started through the
interpreter directly (.venv/bin/python -m pytest) or in CI. Code that shells
out to a project CLI on the bare name therefore works or dies depending on how
it was launched — a whole e2e tier failed on FileNotFoundError: 'axm' for
exactly that reason while the binary sat next to sys.executable.
console_script(name, *, executable=None)
Return the path of console script name for the running environment.
Looks next to the interpreter first (where an installed entry point lands),
then falls back to PATH, then to the bare name so an unusual layout — or
a caller that genuinely wants PATH resolution at exec time — still works.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The console-script name, e.g. |
required |
executable
|
str | None
|
Interpreter whose environment to search; defaults to
:data: |
None
|
Returns:
| Type | Description |
|---|---|
str
|
An absolute path when the script was found, else name unchanged. |