Scanning a Build
In order to collect coverage information SeaLights agents need to first scan the Python script files for the build information.
Scanning a build
Scanning a build in Python is done using the Python agent with the scan flag:
sl-python scanyou can also use the command with explicit parameters
sl-python scan --tokenFile ./sltoken.txt --buildSessionIdFile ./path-to/buildSessionId.txt --scmType noneUsing .slignore to Exclude Files or Directories
Use a .slignore file to exclude specific Python files or directories from being scanned.
It works like a .gitignore, giving you finer control than CLI‑only exclusions.
Create a .slignore file in the project root:
# Comments start with #
# Exclude virtual environments
**/venv/**
**/.venv/**
# Exclude test folders (default behavior also excludes "*tests*")
**/tests/**
# Exclude Python caches
**/__pycache__/**
**/*.pyc
# Exclude generated or vendored code
**/generated/**
**/site-packages/**
# Exclude specific legacy files
legacy/old_script.pyPattern Syntax
.slignore follows .gitignore rules (same as other SeaLights agents): [docs.sealights.io], [docs.sealights.io]
**matches any directory depth*matches any characters within a directoryLines starting with
#are commentsEmpty lines are ignored
Prefix
!to include something inside an excluded area
Merge and Precedence (Simple Rules)
The Python Agent resolves configuration values using the following precedence order (highest to lowest):
Environment variables
CLI parameters (
--excludeFiles,--includeFiles, and others).slignorefile
Important Notes
Environment variables always take precedence over all other configuration sources.
CLI parameters override values defined in the
.slignorefile and default settings.The
.slignorefile is applied during every scan operation (test and runtime execution).Python Agent defaults are applied only when no explicit configuration is provided.
Last updated
Was this helpful?

