CLI⚓︎
cli
⚓︎
Command-line interface for static Gherkin data table validation.
The CLI exposes two operations: check validates Gherkin data tables against
a schema without executing pytest scenarios, and describe renders a schema
contract for humans or tools.
Info
The public console script and python -m talika both delegate to
main() in this module.
_import_object
⚓︎
Import a module:attribute or path.py:attribute reference.
Parameters:
-
reference(str) –Import reference supplied by the CLI user.
Returns:
-
Any–The referenced Python object.
Raises:
-
ValueError–If the reference does not use
module:attributesyntax. -
ImportError–If a referenced Python file cannot be imported.
-
AttributeError–If the attribute path cannot be resolved.
Warning
File references are imported under generated module names. They are intended for CLI loading, not for establishing stable import names.
_schema
⚓︎
Load and validate a table schema import reference.
Parameters:
-
reference(str) –module:Schemaorpath.py:Schemareference.
Returns:
Raises:
-
TypeError–If the reference does not resolve to a
BaseTablesubclass.
Info
Validation happens before command execution so user-facing errors point at import configuration rather than producing partial output.
_context
⚓︎
Call an optional zero-argument project context factory.
Parameters:
-
reference(str | None) –Optional import reference to a callable.
Returns:
Raises:
-
TypeError–If the reference is not callable or does not return a mapping.
Warning
The factory is executed by static checking. It should be deterministic and avoid external side effects.
_diagnostic_data
⚓︎
_diagnostic_data(diagnostic: Diagnostic) -> dict[str, Any]
Return Model v1 fields plus supported legacy aliases.
_diagnostic_payload
⚓︎
_diagnostic_payload(diagnostic: FeatureDiagnostic) -> dict[str, Any]
Convert one feature diagnostic to a stable CLI JSON object.
Parameters:
-
diagnostic(FeatureDiagnostic) –Feature diagnostic produced by static checking.
Returns:
-
dict[str, Any]–Dictionary containing file identity, scenario identity, and structured
-
dict[str, Any]–table error attributes.
Info
The shape is intentionally flat so CI systems and editor integrations can consume diagnostics without understanding Python exception objects.
_print_json
⚓︎
_checker_failure
⚓︎
_checker_failure(exc: Exception) -> TableError
Normalize an operational CLI failure without exposing a traceback.
_render_checker_failure
⚓︎
_render_checker_failure(error: TableError, output_format: str) -> None
Render a controlled checker-level failure in text or JSON form.
_render_describe_text
⚓︎
Return a compact human-readable schema contract.
Parameters:
Returns:
-
str–Multi-line text containing orientation, policies, fields, and variants.
Info
JSON output uses schema.describe().as_dict(). This renderer is
optimized for quick terminal inspection.
build_parser
⚓︎
build_parser() -> ArgumentParser
Create the public argument parser.
Returns:
-
ArgumentParser–Configured
argparse.ArgumentParserfor CLI commands.
main
⚓︎
Run the CLI and return a conventional process exit code.
Parameters:
-
argv(Sequence[str] | None, default:None) –Optional argument sequence.
Nonereads process arguments.
Returns:
Raises:
-
SystemExit–Through
argparseonly when command syntax is invalid.
Warning
check parses matching tables and runs project parsers/validators.
Use --context-factory for deterministic dependencies.