opencomplai 0.1.0__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.
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.pyc
|
|
4
|
+
*.pyo
|
|
5
|
+
.pytest_cache/
|
|
6
|
+
*.egg-info/
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
.coverage
|
|
10
|
+
htmlcov/
|
|
11
|
+
.mypy_cache/
|
|
12
|
+
|
|
13
|
+
# uv — DO NOT ignore uv.lock
|
|
14
|
+
.venv/
|
|
15
|
+
|
|
16
|
+
# Node.js
|
|
17
|
+
node_modules/
|
|
18
|
+
dist/
|
|
19
|
+
*.js.map
|
|
20
|
+
.pnpm-store/
|
|
21
|
+
|
|
22
|
+
# Editors
|
|
23
|
+
.idea/
|
|
24
|
+
.vscode/
|
|
25
|
+
*.swp
|
|
26
|
+
.DS_Store
|
|
27
|
+
.cursor/*
|
|
28
|
+
.autopilot.json
|
|
29
|
+
|
|
30
|
+
# Secrets
|
|
31
|
+
.env
|
|
32
|
+
*.pem
|
|
33
|
+
*.key
|
|
34
|
+
|
|
35
|
+
# Docs build output
|
|
36
|
+
site/
|
|
37
|
+
docs/site/
|
|
38
|
+
docs-env/
|
|
39
|
+
.mkdocs/
|
|
40
|
+
|
|
41
|
+
# Build artifacts
|
|
42
|
+
.mintlify/
|
|
43
|
+
|
|
44
|
+
# Opencomplai generated artifacts (output of `opencomplai init` / `opencomplai check`)
|
|
45
|
+
compliance-artifact.json
|
|
46
|
+
system-manifest.json
|
|
47
|
+
# ...but keep the committed example fixtures used by the scanner docs
|
|
48
|
+
!examples/sample-system/**/system-manifest.json
|
|
49
|
+
!tests/fixtures/**/system-manifest.json
|
|
50
|
+
.venv-ci-check/*
|
|
51
|
+
# GitHub issues sync output (local mirror; may contain PII from issues)
|
|
52
|
+
github-issues/
|
|
53
|
+
|
|
54
|
+
docs/src/assets/js/checker-widget.js
|
|
55
|
+
docs/checker-widget/src/data/
|
|
56
|
+
docs/checker-widget/node_modules/
|
|
57
|
+
packages/cli/src/opencomplai_cli/data/checker-local.html
|
|
58
|
+
|
|
59
|
+
# --- Public-repo hardening (keep AI-tooling and internal artifacts out) ---
|
|
60
|
+
.claude/
|
|
61
|
+
.cursor/
|
|
62
|
+
.autopilot.json
|
|
63
|
+
.selfaudit/
|
|
64
|
+
compliance-reports/
|
|
65
|
+
*.plan.md
|
|
66
|
+
x.key
|
|
67
|
+
.tmp-*.db
|
|
68
|
+
ci-logs/
|
|
69
|
+
tmp/
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: opencomplai
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Opencomplai Python SDK for EU AI Act compliance
|
|
5
|
+
Project-URL: Homepage, https://opencomplai.com
|
|
6
|
+
Project-URL: Documentation, https://docs.opencomplai.com
|
|
7
|
+
Author-email: Opencomplai <hello@opencomplai.com>
|
|
8
|
+
License: AGPL-3.0-only
|
|
9
|
+
Requires-Python: >=3.11
|
|
10
|
+
Requires-Dist: opencomplai-cli>=0.1.0
|
|
11
|
+
Requires-Dist: opencomplai-core>=0.1.0
|
|
12
|
+
Provides-Extra: dev
|
|
13
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
14
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# opencomplai
|
|
18
|
+
|
|
19
|
+
[](https://www.gnu.org/licenses/agpl-3.0)
|
|
20
|
+
[](https://pypi.org/project/opencomplai/)
|
|
21
|
+
[](https://www.python.org/)
|
|
22
|
+
|
|
23
|
+
The convenience meta-package for [Opencomplai](https://opencomplai.com) — EU AI Act
|
|
24
|
+
compliance for your AI systems. Installing `opencomplai` gives you both the risk engine
|
|
25
|
+
and the command-line tool in one step.
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install opencomplai
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
This installs:
|
|
34
|
+
|
|
35
|
+
- [`opencomplai-core`](https://pypi.org/project/opencomplai-core/) — the deterministic,
|
|
36
|
+
rule-based EU AI Act risk engine and code-corroboration scanner.
|
|
37
|
+
- [`opencomplai-cli`](https://pypi.org/project/opencomplai-cli/) — the `opencomplai`
|
|
38
|
+
command-line tool.
|
|
39
|
+
|
|
40
|
+
## Quick start
|
|
41
|
+
|
|
42
|
+
### Command line
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
opencomplai init # scaffold a system-manifest.json
|
|
46
|
+
opencomplai scan # corroborate manifest against code
|
|
47
|
+
opencomplai check # run the compliance gate
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Python SDK
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from opencomplai import assess, AssessmentInput, ModelMetadata
|
|
54
|
+
|
|
55
|
+
result = assess(AssessmentInput(
|
|
56
|
+
model=ModelMetadata(
|
|
57
|
+
name="my-model",
|
|
58
|
+
version="1.0.0",
|
|
59
|
+
modality="text",
|
|
60
|
+
use_case="customer support chatbot",
|
|
61
|
+
deployment_context="production",
|
|
62
|
+
)
|
|
63
|
+
))
|
|
64
|
+
print(result.risk_level)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Public API re-exported from `opencomplai`: `assess`, `AssessmentInput`, `ModelMetadata`,
|
|
68
|
+
`RiskResult`, `ScanStatusArtifact`, and `SystemManifest`.
|
|
69
|
+
|
|
70
|
+
## Optional: AI intent plugin
|
|
71
|
+
|
|
72
|
+
For AI-powered intent classification of code callsites, also install
|
|
73
|
+
[`opencomplai-ai`](https://pypi.org/project/opencomplai-ai/):
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pip install opencomplai-ai
|
|
77
|
+
opencomplai scan --ai-intent
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Documentation
|
|
81
|
+
|
|
82
|
+
Full guides, SDK reference, and the EU AI Act concepts at
|
|
83
|
+
**[docs.opencomplai.com](https://docs.opencomplai.com)**.
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
AGPL-3.0-only. See [LICENSE](https://www.gnu.org/licenses/agpl-3.0).
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# opencomplai
|
|
2
|
+
|
|
3
|
+
[](https://www.gnu.org/licenses/agpl-3.0)
|
|
4
|
+
[](https://pypi.org/project/opencomplai/)
|
|
5
|
+
[](https://www.python.org/)
|
|
6
|
+
|
|
7
|
+
The convenience meta-package for [Opencomplai](https://opencomplai.com) — EU AI Act
|
|
8
|
+
compliance for your AI systems. Installing `opencomplai` gives you both the risk engine
|
|
9
|
+
and the command-line tool in one step.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pip install opencomplai
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
This installs:
|
|
18
|
+
|
|
19
|
+
- [`opencomplai-core`](https://pypi.org/project/opencomplai-core/) — the deterministic,
|
|
20
|
+
rule-based EU AI Act risk engine and code-corroboration scanner.
|
|
21
|
+
- [`opencomplai-cli`](https://pypi.org/project/opencomplai-cli/) — the `opencomplai`
|
|
22
|
+
command-line tool.
|
|
23
|
+
|
|
24
|
+
## Quick start
|
|
25
|
+
|
|
26
|
+
### Command line
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
opencomplai init # scaffold a system-manifest.json
|
|
30
|
+
opencomplai scan # corroborate manifest against code
|
|
31
|
+
opencomplai check # run the compliance gate
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Python SDK
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from opencomplai import assess, AssessmentInput, ModelMetadata
|
|
38
|
+
|
|
39
|
+
result = assess(AssessmentInput(
|
|
40
|
+
model=ModelMetadata(
|
|
41
|
+
name="my-model",
|
|
42
|
+
version="1.0.0",
|
|
43
|
+
modality="text",
|
|
44
|
+
use_case="customer support chatbot",
|
|
45
|
+
deployment_context="production",
|
|
46
|
+
)
|
|
47
|
+
))
|
|
48
|
+
print(result.risk_level)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Public API re-exported from `opencomplai`: `assess`, `AssessmentInput`, `ModelMetadata`,
|
|
52
|
+
`RiskResult`, `ScanStatusArtifact`, and `SystemManifest`.
|
|
53
|
+
|
|
54
|
+
## Optional: AI intent plugin
|
|
55
|
+
|
|
56
|
+
For AI-powered intent classification of code callsites, also install
|
|
57
|
+
[`opencomplai-ai`](https://pypi.org/project/opencomplai-ai/):
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
pip install opencomplai-ai
|
|
61
|
+
opencomplai scan --ai-intent
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Documentation
|
|
65
|
+
|
|
66
|
+
Full guides, SDK reference, and the EU AI Act concepts at
|
|
67
|
+
**[docs.opencomplai.com](https://docs.opencomplai.com)**.
|
|
68
|
+
|
|
69
|
+
## License
|
|
70
|
+
|
|
71
|
+
AGPL-3.0-only. See [LICENSE](https://www.gnu.org/licenses/agpl-3.0).
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "opencomplai"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Opencomplai Python SDK for EU AI Act compliance"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = { text = "AGPL-3.0-only" }
|
|
7
|
+
authors = [{ name = "Opencomplai", email = "hello@opencomplai.com" }]
|
|
8
|
+
requires-python = ">=3.11"
|
|
9
|
+
dependencies = [
|
|
10
|
+
"opencomplai-core>=0.1.0",
|
|
11
|
+
"opencomplai-cli>=0.1.0",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[project.urls]
|
|
15
|
+
Homepage = "https://opencomplai.com"
|
|
16
|
+
Documentation = "https://docs.opencomplai.com"
|
|
17
|
+
|
|
18
|
+
[project.optional-dependencies]
|
|
19
|
+
dev = [
|
|
20
|
+
"pytest>=7.0",
|
|
21
|
+
"ruff>=0.1.0",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[build-system]
|
|
25
|
+
requires = ["hatchling"]
|
|
26
|
+
build-backend = "hatchling.build"
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Opencomplai Python SDK.
|
|
3
|
+
|
|
4
|
+
Quickstart:
|
|
5
|
+
from opencomplai import assess, AssessmentInput, ModelMetadata
|
|
6
|
+
|
|
7
|
+
result = assess(AssessmentInput(
|
|
8
|
+
model=ModelMetadata(
|
|
9
|
+
name="my-model",
|
|
10
|
+
version="1.0.0",
|
|
11
|
+
modality="text",
|
|
12
|
+
use_case="customer support chatbot",
|
|
13
|
+
deployment_context="production",
|
|
14
|
+
)
|
|
15
|
+
))
|
|
16
|
+
print(result.risk_level)
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from opencomplai_core.engine import assess
|
|
20
|
+
from opencomplai_core.models import (
|
|
21
|
+
AssessmentInput,
|
|
22
|
+
ModelMetadata,
|
|
23
|
+
RiskResult,
|
|
24
|
+
ScanStatusArtifact,
|
|
25
|
+
SystemManifest,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
__version__ = "0.1.0"
|
|
29
|
+
__all__ = [
|
|
30
|
+
"AssessmentInput",
|
|
31
|
+
"ModelMetadata",
|
|
32
|
+
"RiskResult",
|
|
33
|
+
"ScanStatusArtifact",
|
|
34
|
+
"SystemManifest",
|
|
35
|
+
"assess",
|
|
36
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""Tests for the Opencomplai Python SDK."""
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
from opencomplai import AssessmentInput, ModelMetadata, RiskResult, assess
|
|
5
|
+
from opencomplai_core.models import RiskLevel
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def _input(use_case: str) -> AssessmentInput:
|
|
9
|
+
"""Build a minimal AssessmentInput for testing."""
|
|
10
|
+
return AssessmentInput(
|
|
11
|
+
model=ModelMetadata(
|
|
12
|
+
name="sdk-test-model",
|
|
13
|
+
version="1.0.0",
|
|
14
|
+
modality="text",
|
|
15
|
+
use_case=use_case,
|
|
16
|
+
deployment_context="production",
|
|
17
|
+
)
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def test_assess_returns_risk_result():
|
|
22
|
+
result = assess(_input("customer support chatbot"))
|
|
23
|
+
assert isinstance(result, RiskResult)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def test_assess_minimal_risk_safe_model():
|
|
27
|
+
result = assess(_input("weather forecasting"))
|
|
28
|
+
assert result.risk_level == RiskLevel.MINIMAL
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def test_assess_high_risk_employment():
|
|
32
|
+
result = assess(_input("employment screening"))
|
|
33
|
+
assert result.risk_level == RiskLevel.HIGH
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_assess_evidence_populated():
|
|
37
|
+
result = assess(_input("customer support chatbot"))
|
|
38
|
+
assert result.evidence_summary
|
|
39
|
+
assert len(result.rule_results) > 0
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def test_assess_raises_on_invalid_input():
|
|
43
|
+
with pytest.raises(Exception): # noqa: B017, PT011 — asserts invalid input raises at all
|
|
44
|
+
assess(None)
|