Environment Variables
PySentry supports environment variables for configuration and debugging.
Configuration Variables
| Variable | Description | Example |
|---|---|---|
PYSENTRY_CONFIG | Override config file path (supports .pysentry.toml or pyproject.toml) | PYSENTRY_CONFIG=/path/to/pyproject.toml |
PYSENTRY_NO_CONFIG | Disable all config file loading | PYSENTRY_NO_CONFIG=1 |
Examples
Override Configuration File
# Use a specific configuration file
PYSENTRY_CONFIG=/path/to/.pysentry.toml pysentry
# Use pyproject.toml from a different location
PYSENTRY_CONFIG=/path/to/pyproject.toml pysentry
Disable Configuration Files
# Run with only CLI arguments, ignore all config files
PYSENTRY_NO_CONFIG=1 pysentry --fail-on high
Color Control
PySentry respects standard terminal color environment variables:
| Variable | Description |
|---|---|
NO_COLOR | Disable color output. Any value (including empty string) disables ANSI colors. See no-color.org |
FORCE_COLOR | Force color output even when stdout is not a terminal |
These variables are handled automatically when --color auto (the default). They have no effect when --color always or --color never is explicitly set.
RUST_LOG for Debugging
For fine-grained logging control, use the RUST_LOG environment variable. When set, it takes precedence over -v flags.
Basic Usage
# Enable debug logging for all pysentry modules
RUST_LOG=pysentry=debug pysentry /path/to/project
# Enable trace logging for specific modules
RUST_LOG=pysentry::parsers=trace pysentry /path/to/project
# Combine multiple module filters
RUST_LOG=pysentry=info,pysentry::dependency=debug pysentry /path/to/project
Common Patterns
# Debug dependency resolution
RUST_LOG=pysentry::dependency=debug pysentry /path/to/project
# Debug vulnerability matching
RUST_LOG=pysentry::vulnerability=debug pysentry /path/to/project
# Debug parser selection
RUST_LOG=pysentry::parsers=debug pysentry /path/to/project
# Debug caching behavior
RUST_LOG=pysentry::cache=debug pysentry /path/to/project
# Full trace output (very verbose)
RUST_LOG=pysentry=trace pysentry /path/to/project
Use Cases
RUST_LOG is useful for:
- Debugging specific components without verbose output from others
- CI/CD environments where you want consistent log levels
- Troubleshooting issues with detailed module-specific logs
- Performance analysis by tracing specific subsystems
Resolver Environment Variables
When using external resolvers for requirements.txt, pyproject.toml, or Pipfile files, PySentry reads these environment variables for cache key differentiation. The resolvers themselves also read these variables from the environment when executed.
This ensures that different index configurations produce different cache entries, preventing incorrect resolution results when switching between package indexes.
UV Resolver
| Variable | Description |
|---|---|
UV_PYTHON | Python interpreter path |
UV_INDEX_URL | Custom PyPI index URL |
UV_EXTRA_INDEX_URL | Extra PyPI index URL |
UV_PRERELEASE | Allow prerelease versions |
pip-tools Resolver
| Variable | Description |
|---|---|
PIP_INDEX_URL | Custom PyPI index URL |
PIP_EXTRA_INDEX_URL | Extra PyPI index URL |
PIP_TRUSTED_HOST | Trusted host for pip |
PIP_PRE | Allow prerelease versions |
Platform-Specific Variables
Cache Directory
PySentry respects standard cache directory environment variables:
| Platform | Variable | Default |
|---|---|---|
| Linux | XDG_CACHE_HOME | ~/.cache |
| macOS | - | ~/Library/Caches |
| Windows | LOCALAPPDATA | %LOCALAPPDATA% |
Override with --cache-dir flag:
pysentry --cache-dir /custom/cache/path