Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.2.0 instead.

compipar-validator

Small, dependency-free validator for Compi test parameter files.

It reads compi.parameters and the optional parameters.metadata.json file used by Compi pipelines, evaluates cross-parameter validation rules, and reports warnings or strict errors.

The package has no GUI dependencies and can be used from Python or from the compipar-validate command line.

Installation

pip install .

For development:

pip install -e ".[dev]"

Supported rules

The top-level validations array in parameters.metadata.json accepts:

{
  "schema_version": 1,
  "parameters": {},
  "validations": [
    {
      "id": "one-of-input",
      "type": "exactly_one",
      "parameters": ["targetFasta", "targetDir"],
      "strict": true
    },
    {
      "id": "optional-mutual-exclusion",
      "type": "at_most_one",
      "parameters": ["modeA", "modeB"]
    },
    {
      "id": "custom-db",
      "type": "requires",
      "when": "useCustomDb",
      "require": ["dbPath", "dbVersion"],
      "message": "When useCustomDb is active, dbPath and dbVersion are required."
    }
  ]
}

Rule types:

  • exactly_one: exactly one parameter in the group must be active.
  • at_most_one: zero or one parameter in the group may be active.
  • requires: when when is active, every parameter in require must be active.

A parameter is active when:

  • it is a flag and it is present;
  • or its value is non-empty and is not one of FALSE, 0, 0.0, NO, OFF, NONE, NULL.

Las reglas no estrictas producen advertencias. Las reglas estrictas hacen que el resultado sea inválido.

Python API

from pathlib import Path

from compipar_validator import validate_files

result = validate_files(
    Path("parameters.metadata.json"),
    Path("compi.parameters"),
)

if result.valid:
    print("Parameters are valid")
else:
    for violation in result.strict_violations:
        print(f"ERROR [{violation.constraint_id}]: {violation.message}")

Lower-level API:

from compipar_validator import (
    evaluate_constraints,
    load_metadata,
    parse_parameters,
    validate_values,
)

document = load_metadata("parameters.metadata.json")
values = parse_parameters("compi.parameters")
result = validate_values(values, document)

load_metadata also exposes metadata problems through document.metadata_issues. Invalid validation rules are reported and ignored; the rest of the rules are still evaluated.

CLI

compipar-validate \
  --metadata parameters.metadata.json \
  --params compi.parameters

Options:

--metadata PATH   parameters.metadata.json
--params PATH     compi.parameters
--json            Machine-readable output on stdout
--quiet           Suppress non-strict warnings
--version         Show the package version

Exit codes:

Code Meaning
0 Valid, or only non-strict warnings
1 At least one strict violation
2 Invalid inputs or arguments
3 Internal error

Example JSON output:

{
  "valid": false,
  "violations": [
    {
      "id": "one-of-input",
      "message": "Debes declarar exactamente uno de: targetFasta, targetDir.",
      "strict": true
    }
  ],
  "metadata_issues": []
}

Development

ruff check src tests
mypy src
pytest
python -m build

License

MIT

Metadata

Release files for compipar-validator 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for compipar-validator 0.1.1
File Size Uploaded Provenance Actions
compipar_validator-0.1.1.tar.gz 13.7 kB Without provenance Details for compipar_validator-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for compipar-validator 0.1.1
File Interpreter ABI Platform Actions
compipar_validator-0.1.1-py3-none-any.whl Python 3 none any Details for compipar_validator-0.1.1-py3-none-any.whl

Total release size: 26.3 kB

Release files / compipar_validator-0.1.1.tar.gz

Download URL compipar_validator-0.1.1.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
060e566fcef457cc4b8ff52269017b6bb8e1b5371d907aeffd69e77bff73d178
BLAKE2b-256 checksum
How to use checksums
6884255c6d33d7c9751bb12945e67eee90f75bfc667a68c745478ac2b79ee81c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.11

Release files / compipar_validator-0.1.1-py3-none-any.whl

Download URL compipar_validator-0.1.1-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
83edf6c613b20fec6f73b7139b2d8c0c50d59281e333baf09d77b59613e13a5a
BLAKE2b-256 checksum
How to use checksums
97e9e43cdfe528747881315cb2109dc827e1664492a5cb8b0623005ca1b1c1ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.11

Security for compipar-validator 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page