Skip to main content

Validator and linter for Portolan catalogs

Project description

rashid

PyPI Python versions CI License

Validator and linter for Portolan catalogs. The name comes from the Arabic root ر ش د, whose participles رَاشِدٌ and رَشِيدٌ mean "taking, or following, a right way or course or direction".

rashid reads a catalog directory and reports every rule it breaks.

Install

uv tool install rashid

Check a catalog

rashid check path/to/catalog

An exit code of 0 means the catalog broke no MUST. An exit code of 1 means it broke at least one.

The default run covers the metadata, structural, and data passes, all offline for local assets. Two passes stay opt-in: --schema (redundant with the hand rules by construction; useful as a cross-check on catalogs from other tooling) and --live (probes the hosting servers, so it needs the network and a published catalog).

rashid check path/to/catalog --live --live-base-url https://data.example.org/my-catalog/

--no-data skips byte verification when the assets are huge or remote and only the metadata verdict is needed. Add --json for a machine-readable report.

What it checks

Validation runs as five separable passes.

Metadata. Every spec requirement rashid can check from the catalog's JSON, without reading asset bytes.

Structural. STAC 1.1.0 core validity, checked offline against the schemas vendored in the wheel. Only the core schema applies. Declared extensions belong to the metadata pass, which keeps an unpublished extension schema from failing the tree.

Schema. The published Portolan profile schema, applied to every object. rashid also implements those requirements in code, which yields precise messages and fix hints. Running both catches drift between them, at the cost of reporting some defects twice. Opt in with --schema.

Data. Asset bytes, local files and remote https URLs alike, checked against the declared metadata and the format rules. rashid recomputes checksum and size, confirms media type by magic number, and enforces storage rules a metadata reader cannot see. Expect a real catalog to fail here on rules its metadata satisfies, because this pass is stricter than what current tooling emits. On by default; --no-data skips it.

Live hosting. The servers behind remote https assets, probed for HTTP range support and CORS. Those are properties of the server rather than of any file. Range and CORS cost one probe per host, and each asset costs one HEAD. Opt in with --live.

A pass that cannot run reports a warning rather than passing quietly.

Use it as a library

from rashid import validate

report = validate("path/to/catalog")
for finding in report.errors:
    print(finding.message)

validate() runs the metadata, structural, and data passes by default, matching the CLI; schema and live opt the remaining two in, and structural=False / data=False opt the defaults out.

RulesConfig skips rules or changes their severity.

from rashid import RulesConfig, Severity, validate

config = RulesConfig(
    disabled=frozenset({"PTL-VIZ-004"}),
    severity_overrides={"PTL-TTL-002": Severity.ERROR},
)
report = validate("path/to/catalog", config=config)

Report also carries passed, warnings, infos, and to_dict().

Rules

Every finding carries a stable id shaped PTL-GROUP-NNN, a severity, a message, and the file path. MUST requirements become errors, and SHOULD requirements become warnings.

docs/rules.md lists the rule groups, the severity exceptions, and the codes rashid emits when a pass degrades.

Contributing

docs/contributing.md covers hook setup, the two-stage gate, and how to run the tests.

SPEC_REF records the portolan-spec commit the vendored fixtures were built from. A nightly workflow re-vendors them and opens a pull request when the spec moves.

License

Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rashid-0.1.1.tar.gz (369.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rashid-0.1.1-py3-none-any.whl (103.2 kB view details)

Uploaded Python 3

File details

Details for the file rashid-0.1.1.tar.gz.

File metadata

  • Download URL: rashid-0.1.1.tar.gz
  • Upload date:
  • Size: 369.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for rashid-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d96f7652a03e25e60311051381b2d2219315aaf702e6a9b62253a831e9c25d46
MD5 b123cf52c0e50e1c2fa9728912f965ae
BLAKE2b-256 3eefe061a1e94b1fb82d910e3769e1afca37b4cc0492fdbadd96b08d83992a77

See more details on using hashes here.

Provenance

The following attestation bundles were made for rashid-0.1.1.tar.gz:

Publisher: publish.yml on portolan-sdi/rashid

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rashid-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: rashid-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 103.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for rashid-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7204dcf73b928b71c51af2de12c8bc1945a23685bd04824a6d1a81a45c9a249f
MD5 5f91f760bb40c3f450dc003bbe6ec9f1
BLAKE2b-256 d8a425a7172961466ee0b53c52130b5fa11c6c1bd7f798c1a436452d43e7f2ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for rashid-0.1.1-py3-none-any.whl:

Publisher: publish.yml on portolan-sdi/rashid

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page