# This file is intended to be sourced by a shell, not doing anything by # default, but adding functions "full-monty" and "no-monty" as enabler and # disabler respectfully of some useful features in Python through environment # variables. Put it somewhere like /etc/profile.d/ or the likes. Or don't 🤷 # # See https://docs.python.org/3/using/cmdline.html#environment-variables function full-monty() { # run in optimized mode, removing assert and debug code export PYTHONOPTIMIZE=1 # use UTF-8 as the default encoding basically everywhere export PYTHONUTF8=1 # use colors where supported (3.13+) export PYTHON_COLORS=1 # attempt to disable the GIL (3.13+) export PYTHON_GIL=0 # enable the JIT compiler (3.13+) export PYTHON_JIT=1 # make lazy imports the default (3.15+) export PYTHON_LAZY_IMPORTS=all } function no-monty() { unset PYTHONOPTIMIZE unset PYTHONUTF8 unset PYTHON_COLORS unset PYTHON_GIL unset PYTHON_JIT unset PYTHON_LAZY_IMPORTS } export -f full-monty export -f no-monty