Configuration¶
Tryke is configured via pyproject.toml under the [tool.tryke] table.
pyproject.toml¶
exclude¶
A list of file paths or directory patterns to exclude from test discovery:
Excluded paths are skipped during both test collection and import graph construction.
src¶
A list of source roots used to resolve absolute imports against the project's files. Defaults to ["."] — the project root — which is correct for projects whose packages live next to pyproject.toml.
For layouts that put the package tree under a subdirectory (for example a maturin project with python-source = "python", where the package lives at python/mypkg/), list that subdirectory so absolute imports in test files resolve to the right source file:
With src = [".", "python"], from mypkg.mod import X in a test file is tried as ./mypkg/mod.py first and then python/mypkg/mod.py — matching how sys.path layers multiple package roots.
Roots earlier in the list take precedence. Roots that don't resolve to a file on disk are skipped silently, so listing "." alongside a subdirectory is safe.
This only affects absolute imports (from foo.bar import x). Relative imports (from .sibling import x) always resolve from the importing file's directory and are unaffected.
python¶
Path to the Python interpreter used to spawn worker processes. Tryke does not enforce requires-python — that is the package manager's job (uv, pip, poetry, hatch). Whatever interpreter you point at is the one that runs your tests.
Defaults to python on Windows and python3 on Unix from PATH.
Path resolution. A value with a path separator (e.g., .venv/bin/python3) is treated as a filesystem path; bare names (e.g., python3, pypy) are looked up via PATH exactly like execvp / CreateProcess. Relative paths are anchored to the directory containing pyproject.toml, not the cwd, so python = ".venv/bin/python3" keeps working when tryke is invoked from a sibling directory or a script. Absolute paths and Windows drive-relative values (e.g., C:foo\\python.exe) are passed through unchanged.
cache_dir¶
Directory for tryke's persistent discovery cache. By default, tryke stores discovery results under <project-root>/.tryke/cache; set cache_dir when that location is not suitable (for example, a read-only project checkout or a shared CI cache directory).
Relative paths are anchored to the directory containing pyproject.toml, not the cwd. The command-line --cache-dir flag takes precedence for one-off runs.
CLI overrides¶
--exclude / -e¶
Override the pyproject.toml exclude list from the command line:
Note: --exclude replaces the config file setting, it does not extend it.
--include / -i¶
Include files or directories that would otherwise be excluded by pyproject.toml:
This is useful for one-off runs against normally excluded paths without editing the config file.
--root¶
Override the project root (where Tryke looks for pyproject.toml and test files):
--cache-dir¶
Override the discovery cache directory from the command line:
--cache-dir is a global flag and overrides [tool.tryke] cache_dir. Relative CLI paths are resolved by the shell/process cwd.
Logging¶
Tryke has a single user-facing verbosity knob with a precedence chain spanning CLI flags, environment variables, and cross-language propagation to the python workers it spawns.
CLI flags¶
-v, -vv, -vvv raise the logging and diagnostic level (info → debug → trace). -q, -qq lower it (error → silent). The default is warn. The text reporter shows per-expectation lines by default; -v is not required for that output.
Environment variables¶
TRYKE_LOG— the umbrella knob. Accepts a bare level name (off,error,warn,info,debug,trace) and propagates to both the rust process and every python worker it spawns. This is what you should set when you want one knob.RUST_LOG— power-user override for the rust side only. Honored natively byenv_logger, so the standard per-module filter syntax (tryke=debug,hyper=warn) works. Does not propagate to python workers — its module-filter grammar doesn't map onto a python log level.
Precedence¶
Rust log filter (consumed by env_logger):
RUST_LOGif set (wins natively).TRYKE_LOGif set.- The CLI flag (
-v/-q). - Default
warn.
Python worker log (spawned by tryke, configured by TRYKE_LOG on the worker env):
TRYKE_LOGif set.- The CLI flag, only when explicitly more verbose than
warn(i.e., the user passed at least one-v). Defaultwarndoes not light up workers — preserves the long-standing "no chatter unless asked" behavior. - Otherwise off.
Examples¶
# Default: rust at warn, workers silent.
tryke test
# `-v` lights up both layers at info.
tryke -v test
# Per-module rust filtering, workers stay silent.
RUST_LOG=tryke=debug,tryke_runner=trace tryke test
# Single knob: both layers at debug, regardless of CLI flag.
TRYKE_LOG=debug tryke test
# RUST_LOG wins for rust filtering; TRYKE_LOG still drives python.
TRYKE_LOG=info RUST_LOG=tryke=warn tryke test
Example¶
A typical configuration for a project with generated code and large fixtures: