Scanning a Build

In order to collect coverage information SeaLights agents need to first scan the Python script files for the build information.

circle-info

See 'Generating an Agent tokenarrow-up-right' for instructions on how to generate a token.

Scanning a build

Scanning a build in Python is done using the Python agent with the scan flag:

sl-python scan

you can also use the command with explicit parameters

sl-python scan --tokenfile ./sltoken.txt --buildsessionidfile ./path-to/buildSessionId.txt --scm none
circle-info

See Scanning a build for command details.

Using .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.py

Pattern Syntax

.slignore follows .gitignore rules (same as other SeaLights agents): [docs.sealights.io]arrow-up-right, [docs.sealights.io]arrow-up-right

  • ** matches any directory depth

  • * matches any characters within a directory

  • Lines starting with # are comments

  • Empty lines are ignored

  • Prefix ! to include something inside an excluded area

Merge & Precedence (Simple Rules)

CLI always wins and .slignore is applied for every scan operation (test/run)

  1. CLI parameters (--exclude, --include)

  2. .slignore file

  3. Python agent defaults

circle-info

Tips

  • Start with minimal patterns and add more as needed.

  • Inspect what’s being scanned by running the scan with high‑verbosity logs.

  • Use .slignore for file‑level control when CLI excludes are too coarse.

Last updated

Was this helpful?