The Python runner in Chase provides automated virtual environment management and seamless test execution.
Chase identifies a Python project if any of the following files are found in the project root:
pyproject.tomlsetup.pysetup.cfg
Chase automatically manages two types of environments:
-
Global Environment:
- Path:
~/venvs/chase_global_env - Purpose: Acts as the dedicated Python host for Neovim (
python3_host_prog). - Setup: Initialized automatically on the first run.
- Path:
-
Project Environment:
- Path:
~/venvs/<parent_dir>_<current_dir>_env - Purpose: Provides an isolated environment for the current project.
- Setup: Created automatically when a Python project is detected.
- Path:
If uv is installed on your system, Chase will use it for all venv operations (creation and package installation), providing significant performance gains. If uv is not found, it seamlessly falls back to standard pip and venv.
When you press <leader>cc:
- Inside a Test:
- Uses Tree-sitter to detect
unittest.TestCaseclasses and methods. - Command:
python -m unittest -v <module>.<class>.<method>
- Uses Tree-sitter to detect
- Outside a Test:
- Command:
python <file>
- Command:
- Main Entry Point:
- If the file contains
if __name__ == "__main__":, Chase prioritizes running the file as the main entry point.
- If the file contains
require("chase").setup({
python = {
enabled = true,
venvs_dir = vim.fs.normalize("~/venvs"),
},
})