Skip to content

Python bytecode caching stays disabled after updating dotfiles

Source: Troubleshooting reference

Symptom: uv run --offline python -c 'import sys; print(sys.dont_write_bytecode)' prints True, or a terminal still exports CMAKE_CXX_COMPILER_LAUNCHER=ccache.

Root cause: a long-lived terminal, IDE, or agent inherited the former PYTHONDONTWRITEBYTECODE=1 and compiler-cache policy. Editing the profile cannot change an already-running parent process, and the old _PROFILE_SOURCED guard could prevent a nested shell from refreshing it.

Fix: apply the managed dotfiles, then run . ~/.profile in Bash/Zsh or start a new Fish shell. Cache policy now refreshes before the guard, and Fish imports explicit unset operations. Python should report False, with bytecode under ~/.cache/python/pycache. A process launched directly by an old IDE can still inherit old values until that IDE restarts. An explicit python -B remains a command-specific bypass. See compiler-cache migration.