Metadata-Version: 2.4
Name: condicio
Version: 0.1.4
Summary: Python tools for the Condicio contract intelligence schema
Author-email: Docfide <opensource@docfide.com>
License-Expression: Apache-2.0
Project-URL: Homepage, https://github.com/docfide/condicio
Project-URL: Repository, https://github.com/docfide/condicio
Project-URL: Documentation, https://github.com/docfide/condicio/blob/main/docs/usage.md
Keywords: contract,schema,clm,contract-intelligence,legal-tech,json-schema
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Legal Industry
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Office/Business :: Financial
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: jsonschema>=4.18
Requires-Dist: referencing>=0.28
Requires-Dist: PyYAML>=6.0

# Condicio Python

Python tools for the [Condicio](https://github.com/docfide/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

```bash
pip install condicio
```

## Usage

### CLI

```bash
# 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

```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:

```python
from condicio.validator import CondicioValidator

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

## License

Apache 2.0
