open-privacy-protocol-engine 0.2.0a1__tar.gz → 0.2.0a3__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.
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/.github/workflows/ci.yml +2 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/PKG-INFO +34 -25
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/README.md +26 -7
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/docs/data-sources.md +33 -13
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/docs/detectors.md +24 -3
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/pyproject.toml +14 -4
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/src/opp_engine/__init__.py +1 -1
- open_privacy_protocol_engine-0.2.0a3/src/opp_engine/cli.py +390 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/src/opp_engine/connectors.py +42 -2
- open_privacy_protocol_engine-0.2.0a3/src/opp_engine/model_hub.py +165 -0
- open_privacy_protocol_engine-0.2.0a3/src/opp_engine/scan.py +293 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/src/opp_engine/server.py +4 -1
- open_privacy_protocol_engine-0.2.0a3/tests/test_model_hub.py +72 -0
- open_privacy_protocol_engine-0.2.0a3/tests/test_scan.py +276 -0
- open_privacy_protocol_engine-0.2.0a1/src/opp_engine/cli.py +0 -158
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/.github/workflows/release.yml +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/.gitignore +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/CODE_OF_CONDUCT.md +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/CONTRIBUTING.md +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/Dockerfile +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/LICENSE +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/NOTICE +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/SECURITY.md +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/assets/brand/icon-512.png +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/assets/brand/logo-transparent-dark.png +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/assets/brand/logo-transparent-white.png +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/docs/agents.md +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/src/opp_engine/data/hygiene_lists.json +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/src/opp_engine/detect.py +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/src/opp_engine/engine.py +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/src/opp_engine/generate.py +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/src/opp_engine/hygiene.py +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/src/opp_engine/mcp_server.py +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/src/opp_engine/model_detector.py +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/src/opp_engine/nosql.py +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/src/opp_engine/report.py +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/tests/fixtures/conformance.destinations.yaml +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/tests/fixtures/conformance.opp.yaml +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/tests/fixtures/northwind-coaching.opp.yaml +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/tests/fixtures/northwind.destinations.yaml +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/tests/sample_data.py +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/tests/test_custom.py +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/tests/test_decision.py +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/tests/test_kit.py +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/tests/test_model_and_hygiene.py +0 -0
- {open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/tests/test_nosql.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: open-privacy-protocol-engine
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.0a3
|
|
4
4
|
Summary: OPP Engine, the reference engine of the privacy context layer for AI: generate Open Privacy Protocol privacy models from any data source and answer agents' checks with decisions over HTTP and MCP
|
|
5
5
|
Project-URL: Homepage, https://openprivacyprotocol.com/engine/
|
|
6
6
|
Project-URL: Documentation, https://openprivacyprotocol.com/engine/data-sources/
|
|
@@ -15,37 +15,32 @@ Classifier: Intended Audience :: Developers
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
16
16
|
Classifier: Topic :: Security
|
|
17
17
|
Requires-Python: >=3.10
|
|
18
|
+
Requires-Dist: numpy>=1.26
|
|
19
|
+
Requires-Dist: onnxruntime>=1.18
|
|
18
20
|
Requires-Dist: open-privacy-protocol>=0.2.0a1
|
|
21
|
+
Requires-Dist: psycopg[binary]>=3.1
|
|
22
|
+
Requires-Dist: pymysql>=1.1
|
|
23
|
+
Requires-Dist: pypdf>=4
|
|
24
|
+
Requires-Dist: python-docx>=1.1
|
|
19
25
|
Requires-Dist: pyyaml>=6.0
|
|
20
26
|
Requires-Dist: sqlalchemy>=2.0
|
|
27
|
+
Requires-Dist: tokenizers>=0.19
|
|
21
28
|
Provides-Extra: all
|
|
22
29
|
Requires-Dist: fastapi>=0.110; extra == 'all'
|
|
23
30
|
Requires-Dist: mcp<3,>=1.2; extra == 'all'
|
|
24
|
-
Requires-Dist: numpy>=1.26; extra == 'all'
|
|
25
|
-
Requires-Dist: onnxruntime>=1.18; extra == 'all'
|
|
26
31
|
Requires-Dist: pyarrow>=15; extra == 'all'
|
|
27
32
|
Requires-Dist: pymongo>=4.6; extra == 'all'
|
|
28
|
-
Requires-Dist: pypdf>=4; extra == 'all'
|
|
29
|
-
Requires-Dist: python-docx>=1.1; extra == 'all'
|
|
30
|
-
Requires-Dist: tokenizers>=0.19; extra == 'all'
|
|
31
33
|
Requires-Dist: uvicorn>=0.29; extra == 'all'
|
|
32
34
|
Provides-Extra: documents
|
|
33
|
-
Requires-Dist: pypdf>=4; extra == 'documents'
|
|
34
|
-
Requires-Dist: python-docx>=1.1; extra == 'documents'
|
|
35
35
|
Provides-Extra: mcp
|
|
36
36
|
Requires-Dist: mcp<3,>=1.2; extra == 'mcp'
|
|
37
37
|
Provides-Extra: model
|
|
38
|
-
Requires-Dist: numpy>=1.26; extra == 'model'
|
|
39
|
-
Requires-Dist: onnxruntime>=1.18; extra == 'model'
|
|
40
|
-
Requires-Dist: tokenizers>=0.19; extra == 'model'
|
|
41
38
|
Provides-Extra: mongodb
|
|
42
39
|
Requires-Dist: pymongo>=4.6; extra == 'mongodb'
|
|
43
40
|
Provides-Extra: mysql
|
|
44
|
-
Requires-Dist: pymysql>=1.1; extra == 'mysql'
|
|
45
41
|
Provides-Extra: parquet
|
|
46
42
|
Requires-Dist: pyarrow>=15; extra == 'parquet'
|
|
47
43
|
Provides-Extra: postgres
|
|
48
|
-
Requires-Dist: psycopg[binary]>=3.1; extra == 'postgres'
|
|
49
44
|
Provides-Extra: server
|
|
50
45
|
Requires-Dist: fastapi>=0.110; extra == 'server'
|
|
51
46
|
Requires-Dist: uvicorn>=0.29; extra == 'server'
|
|
@@ -53,13 +48,8 @@ Provides-Extra: test
|
|
|
53
48
|
Requires-Dist: fastapi>=0.110; extra == 'test'
|
|
54
49
|
Requires-Dist: httpx>=0.27; extra == 'test'
|
|
55
50
|
Requires-Dist: mcp<3,>=1.2; extra == 'test'
|
|
56
|
-
Requires-Dist: numpy>=1.26; extra == 'test'
|
|
57
|
-
Requires-Dist: onnxruntime>=1.18; extra == 'test'
|
|
58
51
|
Requires-Dist: pymongo>=4.6; extra == 'test'
|
|
59
|
-
Requires-Dist: pypdf>=4; extra == 'test'
|
|
60
52
|
Requires-Dist: pytest>=8; extra == 'test'
|
|
61
|
-
Requires-Dist: python-docx>=1.1; extra == 'test'
|
|
62
|
-
Requires-Dist: tokenizers>=0.19; extra == 'test'
|
|
63
53
|
Requires-Dist: uvicorn>=0.29; extra == 'test'
|
|
64
54
|
Description-Content-Type: text/markdown
|
|
65
55
|
|
|
@@ -110,7 +100,7 @@ destination will process the content (an ordinary API, a confidential enclave, e
|
|
|
110
100
|
local model), and answers with a decision that names the obligations the sender must fulfil.
|
|
111
101
|
|
|
112
102
|
```
|
|
113
|
-
databases, files,
|
|
103
|
+
databases, files, opp-engine scan acme.opp.yaml opp-engine serve agents
|
|
114
104
|
documents, web pages ───────────────────────► (review, certify) ──────────────────────► (MCP / HTTP)
|
|
115
105
|
```
|
|
116
106
|
|
|
@@ -139,28 +129,47 @@ New to the ideas? Read [Core concepts](https://openprivacyprotocol.com/get-start
|
|
|
139
129
|
|---|---|
|
|
140
130
|
| **Connect anything** | Any SQLAlchemy database URL (PostgreSQL, MySQL, SQL Server, Oracle, SQLite, Snowflake, BigQuery and more with their drivers); MongoDB and MongoDB Atlas (`mongodb://`, `mongodb+srv://`, with the `[mongodb]` extra), nested fields included; CSV, TSV, JSON, JSON Lines and Parquet files; text, Markdown, HTML, PDF and Word documents; folders and web pages |
|
|
141
131
|
| **Generate** | Every column is classified against the OPP baseline catalog from its name and sampled values; text columns and documents get topic classes (health data, HR matters, internal financials); ID columns get their format (`CE-[0-9]{6}`). Each entry carries its evidence and starts `proposed` |
|
|
142
|
-
| **Better with OPP Model** | With the open-weight [OPP Model](https://github.com/kannancet/open-privacy-protocol-model) (
|
|
132
|
+
| **Better with OPP Model** | With the open-weight [OPP Model](https://github.com/kannancet/open-privacy-protocol-model) (downloaded from Hugging Face on first use and applied automatically by `scan` and `generate`), names, addresses and confidential topics are found in free text and headerless columns, and the organization's own concepts match by meaning |
|
|
143
133
|
| **Industry presets** | `--industry 622110` (a NAICS code) or `--industry healthcare` lists the classes that industry usually holds and were not found |
|
|
144
134
|
| **Hygiene** | Cues, terms and identifier patterns that would match ordinary text are removed and reported |
|
|
145
|
-
| **
|
|
135
|
+
| **One source at a time** | `scan` adds to the model that is there: sources scanned before stay as they are, a source named again is read afresh, `sources` lists them and `remove` takes one out |
|
|
136
|
+
| **Human review** | A Markdown report lists what to check; certified entries survive the next scan |
|
|
146
137
|
| **Serve** | The query engine answers `check` (verdict, findings, safe content), `explain` and `list_classes` over MCP or a REST API |
|
|
147
138
|
|
|
148
139
|
## Quick start
|
|
149
140
|
|
|
150
141
|
```bash
|
|
151
|
-
pip install "open-privacy-protocol-engine[server,mcp
|
|
142
|
+
pip install "open-privacy-protocol-engine[server,mcp]"
|
|
152
143
|
|
|
153
144
|
python tests/sample_data.py demo # a synthetic CRM database, exports and documents
|
|
154
|
-
opp-engine
|
|
155
|
-
|
|
145
|
+
opp-engine scan sqlite:///demo/crm.db demo/docs --org "Acme Coaching (fictional)" --name acme # writes acme.opp.yaml
|
|
146
|
+
opp-engine scan demo/exports # add another source later
|
|
147
|
+
opp-engine sources # what the model covers
|
|
148
|
+
opp-engine remove exports # take a source out again
|
|
156
149
|
|
|
157
150
|
opp-engine check acme.opp.yaml --dest external_ai "Email jane@example.com about CE-123456"
|
|
158
151
|
opp-engine serve acme.opp.yaml --mcp # for any MCP client
|
|
159
152
|
opp-engine serve acme.opp.yaml --http 127.0.0.1:8765 # REST API
|
|
160
153
|
```
|
|
161
154
|
|
|
155
|
+
A source is a database URL, a file, a folder or a web page:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
opp-engine scan postgres://reader@db.internal/crm # asks for the password, hidden; it is not stored
|
|
159
|
+
opp-engine scan env:CRM_URL # or take the whole URL from an environment variable
|
|
160
|
+
```
|
|
161
|
+
|
|
162
162
|
Use a read-only database account. Connection strings are never written into the model; only the
|
|
163
|
-
host and database name are kept.
|
|
163
|
+
host and database name are kept. `scan` reads with the rule detectors and
|
|
164
|
+
[OPP Model](https://huggingface.co/tiny-bubble-company/opp-model), which is downloaded from Hugging Face
|
|
165
|
+
once, verified, and then used from the local cache (`opp-engine model info` shows where). The model
|
|
166
|
+
records which detectors read it under `provenance.notes`.
|
|
167
|
+
|
|
168
|
+
To hand the model to a Hub, add the link the Hub shows: `opp-engine scan SOURCE --hub LINK`, or send
|
|
169
|
+
the file as it is with `opp-engine send LINK`.
|
|
170
|
+
|
|
171
|
+
`opp-engine generate SOURCE... --name N --org O -o FILE` still writes a whole model from the sources
|
|
172
|
+
named in one go, for scripts that rebuild it from scratch.
|
|
164
173
|
|
|
165
174
|
### Connect an agent over MCP
|
|
166
175
|
|
|
@@ -45,7 +45,7 @@ destination will process the content (an ordinary API, a confidential enclave, e
|
|
|
45
45
|
local model), and answers with a decision that names the obligations the sender must fulfil.
|
|
46
46
|
|
|
47
47
|
```
|
|
48
|
-
databases, files,
|
|
48
|
+
databases, files, opp-engine scan acme.opp.yaml opp-engine serve agents
|
|
49
49
|
documents, web pages ───────────────────────► (review, certify) ──────────────────────► (MCP / HTTP)
|
|
50
50
|
```
|
|
51
51
|
|
|
@@ -74,28 +74,47 @@ New to the ideas? Read [Core concepts](https://openprivacyprotocol.com/get-start
|
|
|
74
74
|
|---|---|
|
|
75
75
|
| **Connect anything** | Any SQLAlchemy database URL (PostgreSQL, MySQL, SQL Server, Oracle, SQLite, Snowflake, BigQuery and more with their drivers); MongoDB and MongoDB Atlas (`mongodb://`, `mongodb+srv://`, with the `[mongodb]` extra), nested fields included; CSV, TSV, JSON, JSON Lines and Parquet files; text, Markdown, HTML, PDF and Word documents; folders and web pages |
|
|
76
76
|
| **Generate** | Every column is classified against the OPP baseline catalog from its name and sampled values; text columns and documents get topic classes (health data, HR matters, internal financials); ID columns get their format (`CE-[0-9]{6}`). Each entry carries its evidence and starts `proposed` |
|
|
77
|
-
| **Better with OPP Model** | With the open-weight [OPP Model](https://github.com/kannancet/open-privacy-protocol-model) (
|
|
77
|
+
| **Better with OPP Model** | With the open-weight [OPP Model](https://github.com/kannancet/open-privacy-protocol-model) (downloaded from Hugging Face on first use and applied automatically by `scan` and `generate`), names, addresses and confidential topics are found in free text and headerless columns, and the organization's own concepts match by meaning |
|
|
78
78
|
| **Industry presets** | `--industry 622110` (a NAICS code) or `--industry healthcare` lists the classes that industry usually holds and were not found |
|
|
79
79
|
| **Hygiene** | Cues, terms and identifier patterns that would match ordinary text are removed and reported |
|
|
80
|
-
| **
|
|
80
|
+
| **One source at a time** | `scan` adds to the model that is there: sources scanned before stay as they are, a source named again is read afresh, `sources` lists them and `remove` takes one out |
|
|
81
|
+
| **Human review** | A Markdown report lists what to check; certified entries survive the next scan |
|
|
81
82
|
| **Serve** | The query engine answers `check` (verdict, findings, safe content), `explain` and `list_classes` over MCP or a REST API |
|
|
82
83
|
|
|
83
84
|
## Quick start
|
|
84
85
|
|
|
85
86
|
```bash
|
|
86
|
-
pip install "open-privacy-protocol-engine[server,mcp
|
|
87
|
+
pip install "open-privacy-protocol-engine[server,mcp]"
|
|
87
88
|
|
|
88
89
|
python tests/sample_data.py demo # a synthetic CRM database, exports and documents
|
|
89
|
-
opp-engine
|
|
90
|
-
|
|
90
|
+
opp-engine scan sqlite:///demo/crm.db demo/docs --org "Acme Coaching (fictional)" --name acme # writes acme.opp.yaml
|
|
91
|
+
opp-engine scan demo/exports # add another source later
|
|
92
|
+
opp-engine sources # what the model covers
|
|
93
|
+
opp-engine remove exports # take a source out again
|
|
91
94
|
|
|
92
95
|
opp-engine check acme.opp.yaml --dest external_ai "Email jane@example.com about CE-123456"
|
|
93
96
|
opp-engine serve acme.opp.yaml --mcp # for any MCP client
|
|
94
97
|
opp-engine serve acme.opp.yaml --http 127.0.0.1:8765 # REST API
|
|
95
98
|
```
|
|
96
99
|
|
|
100
|
+
A source is a database URL, a file, a folder or a web page:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
opp-engine scan postgres://reader@db.internal/crm # asks for the password, hidden; it is not stored
|
|
104
|
+
opp-engine scan env:CRM_URL # or take the whole URL from an environment variable
|
|
105
|
+
```
|
|
106
|
+
|
|
97
107
|
Use a read-only database account. Connection strings are never written into the model; only the
|
|
98
|
-
host and database name are kept.
|
|
108
|
+
host and database name are kept. `scan` reads with the rule detectors and
|
|
109
|
+
[OPP Model](https://huggingface.co/tiny-bubble-company/opp-model), which is downloaded from Hugging Face
|
|
110
|
+
once, verified, and then used from the local cache (`opp-engine model info` shows where). The model
|
|
111
|
+
records which detectors read it under `provenance.notes`.
|
|
112
|
+
|
|
113
|
+
To hand the model to a Hub, add the link the Hub shows: `opp-engine scan SOURCE --hub LINK`, or send
|
|
114
|
+
the file as it is with `opp-engine send LINK`.
|
|
115
|
+
|
|
116
|
+
`opp-engine generate SOURCE... --name N --org O -o FILE` still writes a whole model from the sources
|
|
117
|
+
named in one go, for scripts that rebuild it from scratch.
|
|
99
118
|
|
|
100
119
|
### Connect an agent over MCP
|
|
101
120
|
|
{open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/docs/data-sources.md
RENAMED
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
# Connecting data sources
|
|
2
2
|
|
|
3
|
-
`opp-engine
|
|
4
|
-
model. Pass any mix of database URLs, files, folders
|
|
3
|
+
`opp-engine scan` reads one or more sources, samples their values in memory, and writes a privacy
|
|
4
|
+
model, or adds to the one that is already in the folder. Pass any mix of database URLs, files, folders
|
|
5
|
+
and web pages:
|
|
5
6
|
|
|
6
7
|
```bash
|
|
7
|
-
opp-engine
|
|
8
|
+
opp-engine scan <source> [<source> ...]
|
|
8
9
|
```
|
|
9
10
|
|
|
11
|
+
The first scan asks for the organization name (or takes `--org "Acme"`) and writes
|
|
12
|
+
`<name>.opp.yaml`. Later scans need only the source.
|
|
13
|
+
|
|
14
|
+
| Command | What it does |
|
|
15
|
+
|---|---|
|
|
16
|
+
| `opp-engine scan SOURCE...` | Reads the sources into the model. Sources scanned before and not named again stay as they are; a source named again is read afresh and keeps its certified entries. Concepts, terms and rules are never touched. |
|
|
17
|
+
| `opp-engine sources` | Lists the sources in the model, with what was found in each (`--json` for scripts). |
|
|
18
|
+
| `opp-engine remove ID...` | Takes sources out, by id or locator. Identifier formats only they used go with them, unless certified. |
|
|
19
|
+
| `opp-engine send LINK` | Sends the model to a Hub as a draft. `scan ... --hub LINK` does both in one go. |
|
|
20
|
+
|
|
21
|
+
All four work on the `.opp.yaml` in the current folder; name another with `--model FILE`. The file is
|
|
22
|
+
rewritten in a fixed layout, so comments added by hand are not kept.
|
|
23
|
+
|
|
10
24
|
**Before you start**
|
|
11
25
|
|
|
12
26
|
- Use a **read-only** account. The engine only runs `SELECT` / find queries with a row limit.
|
|
@@ -14,23 +28,30 @@ opp-engine generate <source> [<source> ...] --name acme --org "Acme" -o acme.opp
|
|
|
14
28
|
and database name are kept (`postgresql://db.internal:5432/crm`).
|
|
15
29
|
- Values are sampled (200 rows or documents per table by default, `--sample N` to change) and used only
|
|
16
30
|
for classification. No value is ever written into the model, the report or the logs.
|
|
17
|
-
-
|
|
31
|
+
- Leave the password out of the URL. At a terminal the engine asks for it with hidden input, uses it
|
|
32
|
+
for the connection and forgets it. In scripts, put the whole URL in an environment variable and name
|
|
33
|
+
it with `env:`:
|
|
18
34
|
|
|
19
35
|
```bash
|
|
20
|
-
|
|
21
|
-
|
|
36
|
+
opp-engine scan postgres://reader@db.internal/crm # asks: Password for reader@db.internal
|
|
37
|
+
export CRM_URL='postgres://readonly:••••@db.internal:5432/crm'
|
|
38
|
+
opp-engine scan env:CRM_URL # for CI
|
|
22
39
|
```
|
|
23
40
|
|
|
41
|
+
`opp-engine generate SOURCE... --name N --org O -o FILE` writes a whole model from the sources named
|
|
42
|
+
in one go and takes the same sources; use it in scripts that rebuild the model from scratch.
|
|
43
|
+
|
|
24
44
|
## SQL databases
|
|
25
45
|
|
|
26
|
-
Any database with a [SQLAlchemy](https://docs.sqlalchemy.org/en/20/dialects/) dialect works.
|
|
27
|
-
|
|
46
|
+
Any database with a [SQLAlchemy](https://docs.sqlalchemy.org/en/20/dialects/) dialect works. PostgreSQL,
|
|
47
|
+
MySQL and MariaDB work after a plain install and take a plain URL; for the others, install the driver
|
|
48
|
+
next to the engine, then pass the URL. Every schema the account can read is scanned (system schemas
|
|
28
49
|
are skipped).
|
|
29
50
|
|
|
30
51
|
| Database | Install | URL format |
|
|
31
52
|
|---|---|---|
|
|
32
|
-
| PostgreSQL |
|
|
33
|
-
| MySQL / MariaDB |
|
|
53
|
+
| PostgreSQL | nothing extra | `postgres://user@host:5432/dbname` |
|
|
54
|
+
| MySQL / MariaDB | nothing extra | `mysql://user@host:3306/dbname` |
|
|
34
55
|
| SQLite | nothing extra | `sqlite:///path/to/file.db` |
|
|
35
56
|
| Microsoft SQL Server / Azure SQL | `pip install pyodbc` (and the ODBC driver) | `mssql+pyodbc://user:pass@host/dbname?driver=ODBC+Driver+18+for+SQL+Server` |
|
|
36
57
|
| Oracle | `pip install oracledb` | `oracle+oracledb://user:pass@host:1521/?service_name=ORCL` |
|
|
@@ -46,8 +67,7 @@ are skipped).
|
|
|
46
67
|
Tables become datasets of type `table`; each column becomes a field, named as in the database.
|
|
47
68
|
|
|
48
69
|
```bash
|
|
49
|
-
opp-engine
|
|
50
|
-
--name acme --org "Acme" --industry 541511 -o acme.opp.yaml --report review.md
|
|
70
|
+
opp-engine scan postgres://readonly@db.internal/crm --industry 541511 --report review.md
|
|
51
71
|
```
|
|
52
72
|
|
|
53
73
|
## NoSQL databases
|
|
@@ -122,7 +142,7 @@ The page is fetched once and read as a document.
|
|
|
122
142
|
- Re-run with `--merge acme.opp.yaml` to keep entries people already **certified** and add only new findings.
|
|
123
143
|
- Add `--industry <NAICS code>` so the review report lists classes your industry usually holds that were not
|
|
124
144
|
found.
|
|
125
|
-
-
|
|
145
|
+
- OPP Model finds names, addresses and topics in free-text columns too; `generate` downloads and uses it automatically (`--no-opp-model` turns it off).
|
|
126
146
|
|
|
127
147
|
## Troubleshooting
|
|
128
148
|
|
{open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/docs/detectors.md
RENAMED
|
@@ -37,8 +37,29 @@ release folder (`model.onnx`, `tokenizer.json`, `labels.json`) gives three thing
|
|
|
37
37
|
- **Meaning match:** a text vector that matches an organization's own concepts by their
|
|
38
38
|
description. Used only when the release's `labels.json` marks `text_vec` as `ready`.
|
|
39
39
|
|
|
40
|
+
Releases are published on Hugging Face as [`tiny-bubble-company/opp-model`](https://huggingface.co/tiny-bubble-company/opp-model),
|
|
41
|
+
one tag per version. `pip install open-privacy-protocol-engine` installs the model runtime (ONNX Runtime,
|
|
42
|
+
tokenizers, NumPy); the model itself is downloaded on first use, because pip cannot run code at install
|
|
43
|
+
time. `opp-engine generate` then uses it automatically:
|
|
44
|
+
|
|
40
45
|
```bash
|
|
41
|
-
pip install "open-privacy-protocol-engine[
|
|
42
|
-
opp-engine generate postgresql://reader@db/crm --name acme --org Acme
|
|
43
|
-
opp-engine
|
|
46
|
+
pip install "open-privacy-protocol-engine[postgres]"
|
|
47
|
+
opp-engine generate postgresql://reader@db/crm --name acme --org Acme # downloads OPP Model once, then uses it
|
|
48
|
+
opp-engine model pull # or download it ahead of time (container images, offline machines)
|
|
49
|
+
opp-engine model info # version, cache folder and the release's acceptance results
|
|
44
50
|
```
|
|
51
|
+
|
|
52
|
+
- **Version:** each engine release pins a model release and ships its SHA-256 digests, so a file
|
|
53
|
+
changed on the Hub is refused. `OPP_MODEL_REVISION=v2` (or `opp-engine model pull --revision v2`)
|
|
54
|
+
uses another release, checked against that release's own `SHA256SUMS`.
|
|
55
|
+
- **Cache:** `$OPP_MODEL_HOME`, else `$XDG_CACHE_HOME/opp-engine/models`, else `~/.cache/opp-engine/models`.
|
|
56
|
+
After the first download the engine works offline.
|
|
57
|
+
- **Off or elsewhere:** `--no-opp-model` or `OPP_MODEL=off` runs on rules only; `--opp-model ./folder`
|
|
58
|
+
(or `OPP_MODEL=./folder`) uses a release folder you manage. `HF_ENDPOINT` points at a mirror.
|
|
59
|
+
- **Offline first run:** if the model cannot be downloaded, `generate` says so and continues with the
|
|
60
|
+
rule detectors.
|
|
61
|
+
- **`check`, `explain` and `serve`** use the model only when asked (`--opp-model auto`, a folder, or
|
|
62
|
+
`OPP_MODEL`), so a decision point never changes behaviour because a download happened.
|
|
63
|
+
|
|
64
|
+
Every class the model finds is written as `proposed`, like every other finding, so a person reviews it
|
|
65
|
+
before it is certified.
|
{open_privacy_protocol_engine-0.2.0a1 → open_privacy_protocol_engine-0.2.0a3}/pyproject.toml
RENAMED
|
@@ -22,17 +22,27 @@ dependencies = [
|
|
|
22
22
|
"open-privacy-protocol>=0.2.0a1",
|
|
23
23
|
"pyyaml>=6.0",
|
|
24
24
|
"sqlalchemy>=2.0",
|
|
25
|
+
# OPP Model runtime: the model itself comes from Hugging Face on first use (opp-engine model pull).
|
|
26
|
+
"onnxruntime>=1.18",
|
|
27
|
+
"tokenizers>=0.19",
|
|
28
|
+
"numpy>=1.26",
|
|
29
|
+
# The common sources work after a plain install: PostgreSQL, MySQL/MariaDB, PDF and Word.
|
|
30
|
+
"psycopg[binary]>=3.1",
|
|
31
|
+
"pymysql>=1.1",
|
|
32
|
+
"pypdf>=4",
|
|
33
|
+
"python-docx>=1.1",
|
|
25
34
|
]
|
|
26
35
|
|
|
27
36
|
[project.optional-dependencies]
|
|
28
37
|
server = ["fastapi>=0.110", "uvicorn>=0.29"]
|
|
29
38
|
mcp = ["mcp>=1.2,<3"]
|
|
30
|
-
documents = ["pypdf>=4", "python-docx>=1.1"]
|
|
31
39
|
parquet = ["pyarrow>=15"]
|
|
32
|
-
model = ["onnxruntime>=1.18", "tokenizers>=0.19", "numpy>=1.26"]
|
|
33
|
-
postgres = ["psycopg[binary]>=3.1"]
|
|
34
40
|
mongodb = ["pymongo>=4.6"]
|
|
35
|
-
|
|
41
|
+
# Kept for old install lines: these are now core dependencies.
|
|
42
|
+
model = []
|
|
43
|
+
documents = []
|
|
44
|
+
postgres = []
|
|
45
|
+
mysql = []
|
|
36
46
|
all = ["open-privacy-protocol-engine[server,mcp,documents,parquet,model,mongodb]"]
|
|
37
47
|
test = ["pytest>=8", "httpx>=0.27", "open-privacy-protocol-engine[server,mcp,documents,model,mongodb]"]
|
|
38
48
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""opp-engine: generate OPP privacy models from any source and serve them to agents."""
|
|
2
|
-
__version__ = "0.2.
|
|
2
|
+
__version__ = "0.2.0a3"
|