Skip to main content

CQL2 JSON Pydantic

PyPI - Version PyPI - Python Version GitHub Actions Workflow Status Code coverage

Pydantic v2 models for building CQL2 JSON filters.

Quick start

pip install cql2json-pydantic
from cql2json_pydantic import BinaryComparisonPredicate, BinaryComparisonPredicateOp, PropertyRef

query = BinaryComparisonPredicate(
    op=BinaryComparisonPredicateOp.EQUAL,
    args=[PropertyRef(property="city"), "Toronto"],
)
print(query.model_dump_json(exclude_none=True))

Output:

{"op":"=","args":[{"property":"city"},"Toronto"]}

Use model_dump_json(indent=2, exclude_none=True) for formatted JSON, or model_dump(mode="json", exclude_none=True) for a JSON-compatible Python dictionary.

See more filter examples and their JSON output.

Project conventions

This project is templated a Hatch-based Python package with:

  • Apache-2.0 license
  • Keep a Changelog-compatible CHANGELOG.md
  • Diátaxis documentation under docs/
  • top-level mkdocs.yaml
  • Taskfile integration with Terradue/taskfile-utils
  • GitHub Actions CI

Documentation

Project documentation: https://terradue.github.io/cql2json-pydantic/

Contribute

Submit a Github issue if you have comments or suggestions.

Local quality checks

Install Hatch and Taskfiles then install the Git hook:

task quality:pre-commit:install

Every commit runs Ruff (including the configured McCabe complexity limit), Ruff formatting, strict mypy checks, and the pytest suite.

Run the complete hook explicitly with:

task quality:pre-commit:run

License

Apache License, Version 2.0

Metadata

Release files for cql2json-pydantic 0.1.0

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

Source distribution (sdist)

Source distribution for cql2json-pydantic 0.1.0
File Size Uploaded Provenance Actions
cql2json_pydantic-0.1.0.tar.gz 30.0 kB With provenance Details for cql2json_pydantic-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cql2json-pydantic 0.1.0
File Interpreter ABI Platform Actions
cql2json_pydantic-0.1.0-py3-none-any.whl Python 3 none any Details for cql2json_pydantic-0.1.0-py3-none-any.whl

Total release size: 41.4 kB

Release files / cql2json_pydantic-0.1.0.tar.gz

Download URL cql2json_pydantic-0.1.0.tar.gz
Size 30.0 kB
Tags Source
SHA-256 checksum
How to use checksums
914e1dfa668194a23d7f23286ca4dbc6544946c79ec459a503cf600352f8d275
BLAKE2b-256 checksum
How to use checksums
654709a58a0e71c4c4d16bf605f10892112bc8d6ad53f4f4b99858325f99de6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.

Transparency log

Release files / cql2json_pydantic-0.1.0-py3-none-any.whl

Download URL cql2json_pydantic-0.1.0-py3-none-any.whl
Size 11.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
632f3d239cd90d663df8fa8025860aa478389e2f0d2ed09834d45cbbc84b9826
BLAKE2b-256 checksum
How to use checksums
4484cad246be3d54c05e0d86adcdf2c837a8c69aa569f71f11ee566d201664d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.

Transparency log

Security for cql2json-pydantic 0.1.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cql2json_pydantic-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 9, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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