contractgate 0.2.0__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. {contractgate-0.2.0 → contractgate-0.3.1}/.gitignore +2 -0
  2. contractgate-0.3.1/CHANGELOG.md +49 -0
  3. {contractgate-0.2.0 → contractgate-0.3.1}/LICENSE +1 -1
  4. {contractgate-0.2.0 → contractgate-0.3.1}/PKG-INFO +4 -4
  5. {contractgate-0.2.0 → contractgate-0.3.1}/README.md +1 -1
  6. {contractgate-0.2.0 → contractgate-0.3.1}/pyproject.toml +3 -3
  7. {contractgate-0.2.0 → contractgate-0.3.1}/src/contractgate/__init__.py +2 -2
  8. contractgate-0.3.1/src/contractgate/_version.py +1 -0
  9. {contractgate-0.2.0 → contractgate-0.3.1}/src/contractgate/async_client.py +1 -1
  10. {contractgate-0.2.0 → contractgate-0.3.1}/src/contractgate/client.py +1 -1
  11. {contractgate-0.2.0 → contractgate-0.3.1}/src/contractgate/exceptions.py +1 -1
  12. contractgate-0.3.1/src/contractgate/llm.py +692 -0
  13. {contractgate-0.2.0 → contractgate-0.3.1}/src/contractgate/models.py +6 -4
  14. contractgate-0.3.1/tests/test_llm_gate.py +716 -0
  15. contractgate-0.2.0/CHANGELOG.md +0 -14
  16. contractgate-0.2.0/src/contractgate/_version.py +0 -1
  17. contractgate-0.2.0/tests/__init__.py +0 -0
  18. {contractgate-0.2.0 → contractgate-0.3.1}/src/contractgate/_transport.py +0 -0
  19. {contractgate-0.2.0 → contractgate-0.3.1}/src/contractgate/contract.py +0 -0
  20. {contractgate-0.2.0 → contractgate-0.3.1}/src/contractgate/validator.py +0 -0
  21. {contractgate-0.2.0/contractgate → contractgate-0.3.1/tests}/__init__.py +0 -0
  22. {contractgate-0.2.0 → contractgate-0.3.1}/tests/conftest.py +0 -0
  23. {contractgate-0.2.0 → contractgate-0.3.1}/tests/fixtures/contracts/compliance_mode.yaml +0 -0
  24. {contractgate-0.2.0 → contractgate-0.3.1}/tests/fixtures/contracts/user_events.yaml +0 -0
  25. {contractgate-0.2.0 → contractgate-0.3.1}/tests/fixtures/contracts/with_transform.yaml +0 -0
  26. {contractgate-0.2.0 → contractgate-0.3.1}/tests/test_client_async.py +0 -0
  27. {contractgate-0.2.0 → contractgate-0.3.1}/tests/test_client_sync.py +0 -0
  28. {contractgate-0.2.0 → contractgate-0.3.1}/tests/test_contract_parse.py +0 -0
  29. {contractgate-0.2.0 → contractgate-0.3.1}/tests/test_validator.py +0 -0
@@ -38,6 +38,8 @@ dashboard/public/llms.txt
38
38
  dashboard/public/llm-integration.md
39
39
  dashboard/public/llms-full.txt
40
40
  dashboard/public/mcp-reference.md
41
+ dashboard/public/llm-output-validation.md
42
+ dashboard/public/llm-sdk-reference.md
41
43
  # Added by code-review-graph
42
44
  .code-review-graph/
43
45
 
@@ -0,0 +1,49 @@
1
+ # Changelog
2
+
3
+ All notable changes to the `contractgate` Python SDK.
4
+
5
+ ## 0.3.1 — 2026-10-13
6
+
7
+ Fixes from end-to-end testing against production. No API changes.
8
+
9
+ - Fix: `LLMGate(contract_id="<name>")` crashed with `KeyError: 'created_at'`.
10
+ `GET /contracts` returns summary rows without timestamps;
11
+ `ContractResponse.created_at` / `updated_at` are now optional.
12
+ - Fix: a rejected LLM output now returns `LLMGateResult(ok=False, violations=[...])`
13
+ instead of raising `ValidationFailedError`. The gateway answers 422 when every
14
+ event fails, which is always true for a gate's single-event batch, so
15
+ `validate_only` and the `auto_repair` loop never saw the violations. A 422
16
+ without an egress body (e.g. a deprecated version pin) is still raised.
17
+ - Default `base_url` is `https://api.datacontractgate.com` (was the dashboard host).
18
+
19
+ ## 0.3.0 — 2026-10-11
20
+
21
+ RFC-094. Adds the `contractgate.llm` submodule for LLM output
22
+ validation. No breaking changes.
23
+
24
+ - New: `contractgate.llm.LLMGate` and `contractgate.llm.AsyncLLMGate`
25
+ wrap `/egress/{contract_id}` with response-shape extraction and a
26
+ bounded auto-repair re-prompt loop. Caller binds their own LLM
27
+ client (OpenAI / Anthropic / Ollama / vLLM) via `llm=...`; the SDK
28
+ takes no runtime dependency on provider SDKs.
29
+ - New: `contractgate.llm.extract_json(response)` handles OpenAI chat
30
+ JSON mode, OpenAI tool_calls, OpenAI Responses `output_parsed`,
31
+ Anthropic `tool_use` and text-block JSON, raw strings (with
32
+ markdown-fence tolerance), and dict passthrough.
33
+ - New: `contractgate.llm.LLMResponseError` for streaming responses
34
+ (rejected in v1) and unparseable shapes.
35
+ - New: `LLMGate.mask_prompt(payload, prompt_contract_id=...)` returns
36
+ the RFC-004-transformed form of a prompt dict via
37
+ `ingest(dry_run=True)`.
38
+ - Sister alias package `aischemagate` ships at the same cut.
39
+
40
+ ## 0.1.0 — 2026-04-28
41
+
42
+ Initial scaffold per RFC-005.
43
+
44
+ - `Client` (sync) + `AsyncClient` (async) over httpx.
45
+ - `ingest`, `audit`, `get_contract`, `get_version`, `playground`.
46
+ - Local validator (`Contract.from_yaml`, `CompiledContract.validate`).
47
+ - Strict parity with Rust validator: same `ViolationKind`, same field
48
+ paths, same message text. Locked via shared fixture corpus.
49
+ - No PII transforms in the local validator (RFC-004 invariant).
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 ContractGate
3
+ Copyright (c) 2026 DataContractGate
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: contractgate
3
- Version: 0.2.0
4
- Summary: Python SDK for ContractGate — high-performance semantic contract enforcement gateway.
3
+ Version: 0.3.1
4
+ Summary: Python SDK for DataContractGate — high-performance semantic contract enforcement gateway.
5
5
  Project-URL: Homepage, https://datacontractgate.com
6
6
  Project-URL: Source, https://github.com/nightmoose/contractgate
7
- Author: ContractGate
7
+ Author: NightMoose, Inc.
8
8
  License: MIT
9
9
  License-File: LICENSE
10
10
  Keywords: contract,data-quality,ingestion,schema,validation
@@ -30,7 +30,7 @@ Description-Content-Type: text/markdown
30
30
 
31
31
  # contractgate (Python SDK)
32
32
 
33
- First-party Python SDK for [ContractGate][gw] — a high-performance
33
+ First-party Python SDK for [DataContractGate][gw] — a high-performance
34
34
  semantic contract enforcement gateway (Patent Pending).
35
35
 
36
36
  [gw]: https://datacontractgate.com
@@ -1,6 +1,6 @@
1
1
  # contractgate (Python SDK)
2
2
 
3
- First-party Python SDK for [ContractGate][gw] — a high-performance
3
+ First-party Python SDK for [DataContractGate][gw] — a high-performance
4
4
  semantic contract enforcement gateway (Patent Pending).
5
5
 
6
6
  [gw]: https://datacontractgate.com
@@ -4,12 +4,12 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "contractgate"
7
- version = "0.2.0"
8
- description = "Python SDK for ContractGate — high-performance semantic contract enforcement gateway."
7
+ version = "0.3.1"
8
+ description = "Python SDK for DataContractGate — high-performance semantic contract enforcement gateway."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
11
11
  license = { text = "MIT" }
12
- authors = [{ name = "ContractGate" }]
12
+ authors = [{ name = "NightMoose, Inc." }]
13
13
  keywords = ["contract", "validation", "data-quality", "ingestion", "schema"]
14
14
  classifiers = [
15
15
  "Development Status :: 3 - Alpha",
@@ -1,6 +1,6 @@
1
- """ContractGate Python SDK.
1
+ """DataContractGate Python SDK.
2
2
 
3
- First-party client and pure-Python validator for the ContractGate
3
+ First-party client and pure-Python validator for the DataContractGate
4
4
  semantic contract enforcement gateway.
5
5
 
6
6
  Public surface:
@@ -0,0 +1 @@
1
+ __version__ = "0.3.1"
@@ -31,7 +31,7 @@ from contractgate.models import (
31
31
 
32
32
 
33
33
  class AsyncClient:
34
- """Asynchronous client for the ContractGate gateway."""
34
+ """Asynchronous client for the DataContractGate gateway."""
35
35
 
36
36
  def __init__(
37
37
  self,
@@ -25,7 +25,7 @@ from contractgate.models import (
25
25
 
26
26
 
27
27
  class Client:
28
- """Synchronous client for the ContractGate gateway.
28
+ """Synchronous client for the DataContractGate gateway.
29
29
 
30
30
  Construct with the gateway's ``base_url`` and your API key:
31
31
 
@@ -1,4 +1,4 @@
1
- """Exception hierarchy for the ContractGate SDK.
1
+ """Exception hierarchy for the DataContractGate SDK.
2
2
 
3
3
  All SDK exceptions inherit from ``ContractGateError`` so users can
4
4
  catch the entire surface with one ``except``. HTTP-shaped errors carry