Configuration#

Configuration loading and schema for jamb.

JambConfig#

class jamb.config.loader.JambConfig[source]#

Configuration schema for jamb.

test_documents#

Document prefixes that represent test specifications.

Type:

list[str]

fail_uncovered#

Fail the pytest session when any normative item lacks test coverage.

Type:

bool

require_all_pass#

Require all linked tests to pass for an item to be considered covered.

Type:

bool

test_matrix_output#

File path for the generated test records matrix, or None to skip generation. Format is inferred from file extension (.html, .json, .csv, .md, .xlsx).

Type:

str | None

trace_matrix_output#

File path for the generated traceability matrix, or None to skip generation. Format is inferred from file extension (.html, .json, .csv, .md, .xlsx).

Type:

str | None

exclude_patterns#

Glob patterns for documents or items to exclude from processing.

Type:

list[str]

trace_to_ignore#

Document prefixes to exclude from the “Traces To” column in the traceability matrix.

Type:

list[str]

software_version#

Software version for the traceability matrix. If None, auto-parsed from [project].version in pyproject.toml.

Type:

str | None

trace_from#

Starting document prefix for full chain trace matrix generation. When set, generates a full chain matrix instead of the simple trace matrix.

Type:

str | None

include_ancestors#

Whether to include a “Traces To” column showing ancestors of the starting items in full chain matrices.

Type:

bool

Construct a config with custom settings::

    >>> config = JambConfig(
    ...     test_documents=["SRS"],
    ...     fail_uncovered=True,
    ...     test_matrix_output="test-records.html",
    ... )
    >>> config.test_documents
    ['SRS']
    >>> config.fail_uncovered
    True
validate(available_documents)[source]#

Validate configuration against available documents.

Parameters:

available_documents (list[str]) – List of document prefixes discovered in the project.

Returns:

list[str] – List of validation warning messages. Empty if no issues found.

Return type:

list[str]

__init__(test_documents=<factory>, fail_uncovered=False, require_all_pass=True, test_matrix_output=None, trace_matrix_output=None, exclude_patterns=<factory>, trace_to_ignore=<factory>, software_version=None, trace_from=None, include_ancestors=False)#
Parameters:
  • test_documents (list[str])

  • fail_uncovered (bool)

  • require_all_pass (bool)

  • test_matrix_output (str | None)

  • trace_matrix_output (str | None)

  • exclude_patterns (list[str])

  • trace_to_ignore (list[str])

  • software_version (str | None)

  • trace_from (str | None)

  • include_ancestors (bool)

Return type:

None

load_config#

jamb.config.loader.load_config(config_path=None)[source]#

Load jamb configuration from pyproject.toml.

Looks for [tool.jamb] section. Also auto-parses software version from [project].version if not explicitly set in [tool.jamb].

Parameters:

config_path (Path | None) – Optional path to pyproject.toml. If None, uses cwd.

Returns:

JambConfig – JambConfig with loaded values or defaults.

Return type:

JambConfig

Load configuration from the default path (``pyproject.toml`` in
the current working directory)::

    >>> config = load_config()
    >>> config.matrix_format
    'html'

Load from a specific path::

    >>> from pathlib import Path
    >>> config = load_config(Path("myproject/pyproject.toml"))