Environment
Toggle
- PYTHONPRETTY
This environment variable can toggle on or off the main hook for pretty.
When this environment variable is set to a truthy value all pretty modules will be hooked, unless the module is explicitly disabled with its respective PYTHONPRETTY* environment variable.
This means that in order to enable, say, all pretty modules bar pretty.traceback you could set PYTHONPRETTY to a truthy value and set PYTHONPRETTYTRACEBACK to a falsey value.
When this environment variable is set to a falsey value no pretty module will be hooked, regardless of the state of its respective PYTHONPRETTY* environment variable.
This means that in order to temporarily disable pretty output, you can simply set PYTHONPRETTY to a falsey value.
When this environment variable is unset, the state of each PYTHONPRETTY* environment variable is used to determine whether its respective module will be hooked.
- PYTHONPRETTYTRACEBACK
This environment variable can toggle on or off the
hook()
for pretty.traceback.When this environment variable is set to a truthy value, after considering the state of the PYTHONPRETTY environment variable,
pretty.traceback.hook()
is called.When this environment variable is set to a falsey value
pretty.traceback.hook()
is not called.When this environment variable is unset, after considering the state of the PYTHONPRETTY environment variable,
pretty.traceback.hook()
is not called.
Theme
- PYTHONPRETTYTHEME
This environment variable can contain a theme by which a formatter might format its output.
When this environment variable is set, its value will merge with the default pretty theme via
default.update(custom)
.When this environment variable is unset, the default pretty theme is used.
The theme can contain the following keys.
- ast_comment_sgr
The SGR value given to comment tokens in an abstract syntax tree.
- ast_delimiter_sgr
The SGR value given to the following delimiter tokens in an abstract syntax tree.
(
)
[
]
{
}
,
:
.
;
\
- ast_keyword_sgr
The SGR value given to the following keyword tokens in an abstract syntax tree.
_
(in Python 3.10+ as described by soft keyword tokens)and
as
assert
async
await
break
case
(in Python 3.10+ as described by soft keyword tokens)class
continue
def
del
elif
else
except
finally
for
from
global
if
import
in
is
lambda
match
(in Python 3.10+ as described by soft keyword tokens)nonlocal
not
or
pass
raise
return
try
while
with
yield
- ast_name_sgr
The SGR value given to name tokens in an abstract syntax tree.
- ast_operator_sgr
The SGR value given to operator tokens in an abstract syntax tree.
Color
- PYTHONPRETTYANSI
This environment variable can toggle on or off ANSI output for pretty.
When this environment variable is set to a truthy value ANSI output will be enabled, regardless of the state of the NO_COLOR environment variable.
When this environment variable is set to a falsey value ANSI output will be disabled, regardless of the state of the NO_COLOR environment variable.
When this environment variable is unset the value of the NO_COLOR environment variable is considered, before ANSI output remains enabled by default.
- NO_COLOR
This environment variable can toggle on or off ANSI output for all supporting software.
Value
- boolean value
An environment variable with this value type corresponds to either the boolean value FALSE or the boolean value TRUE.
The following case-insensitive values are considered FALSE:
0
false
off
disable
no
n
The following case-insensitive values are considered TRUE:
1
true
on
enable
yes
y
When the value of a boolean environment variable does not match any of the above values, it will fall back to its unset behavior.
- JSON value
An environment variable with this value type corresponds to a JSON-encoded key-value mapping.
When the value of a JSON environment variable does not parse or does not produce a mapping, it will fall back to its unset behavior.
- SGR value
A theme item with this value type corresponds to a tuple of two SGR values, a single SGR value, or
None
.When a theme item with this value type is set to
None
, the corresponding theme item will be ignored.When a theme item with this value type is set to a tuple of two SGR values, for example
("38;2;255;179;255", "39")
, the values are used as the start and end format for the corresponding token.When a theme item with this value type is set to a single SGR value, for example
"1"
, the value is used as the start format for the corresponding token, with the end defaulting to"0"
.