Skip to main content

Python tools for the Condicio contract intelligence schema

Project description

Condicio Python

Python tools for the Condicio contract intelligence schema.

  • Validate Condicio documents against the JSON Schema
  • Work with typed models — dataclasses for every schema type
  • Serialize/deserialize to/from JSON and YAML
  • CLI for validation and inspection

Install

pip install condicio

Usage

CLI

# Validate a Condicio document
condicio validate document.json

# Validate with verbose output
condicio validate document.json --verbose

# Load from YAML
condicio validate document.yaml

Python

from condicio.validator import validate_document
from condicio.models import CondicioDocument, Party, Obligation

# Validate a raw dict
with open("document.json") as f:
    import json
    data = json.load(f)

errors = validate_document(data)
if errors:
    for err in errors:
        print(f"  {err.path}: {err.message}")
else:
    print("Valid Condicio document")

# Deserialize to typed models
from condicio.models import document_from_dict

doc = document_from_dict(data)
print(f"Contract: {doc.contract.title}")
for party in doc.parties:
    print(f"  Party: {party.name} ({party.role})")

Schema URL

By default, the validator fetches the latest schema from:

https://raw.githubusercontent.com/docfide/condicio/main/schema/condicio.schema.json

You can pass a custom schema path or URL:

from condicio.validator import CondicioValidator

v = CondicioValidator(schema_path="path/to/condicio.schema.json")
errors = v.validate(data)

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

condicio-0.1.3.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

condicio-0.1.3-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file condicio-0.1.3.tar.gz.

File metadata

  • Download URL: condicio-0.1.3.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for condicio-0.1.3.tar.gz
Algorithm Hash digest
SHA256 15c00b7dbee09d2c7e546c21c54292582eeabd65a825ec14a44c00d0b3d6b212
MD5 5ecea576fc32a802eed7380748e128c5
BLAKE2b-256 e7ad68233cd5c8bb26abf446bbb8e264ea0c497ac0a8642f4b5bd931e848f5e5

See more details on using hashes here.

File details

Details for the file condicio-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: condicio-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for condicio-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a3de13ff344634794137dda851f949136fd532dc0494bf2192789a97214e345b
MD5 34a6f46f6fb533cf94d0b65fa476fbff
BLAKE2b-256 924db37d4efd40741626194c778507138233a406063382b62cb6a92bdc3caaf0

See more details on using hashes here.

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