pydatagraphs 0.4.6__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.
- pydatagraphs-0.4.6/LICENSE +20 -0
- pydatagraphs-0.4.6/PKG-INFO +164 -0
- pydatagraphs-0.4.6/README.md +120 -0
- pydatagraphs-0.4.6/pyproject.toml +56 -0
- pydatagraphs-0.4.6/src/datagraphs/__init__.py +20 -0
- pydatagraphs-0.4.6/src/datagraphs/client.py +494 -0
- pydatagraphs-0.4.6/src/datagraphs/dataset.py +121 -0
- pydatagraphs-0.4.6/src/datagraphs/enums.py +27 -0
- pydatagraphs-0.4.6/src/datagraphs/gateway.py +304 -0
- pydatagraphs-0.4.6/src/datagraphs/py.typed +0 -0
- pydatagraphs-0.4.6/src/datagraphs/schema.py +624 -0
- pydatagraphs-0.4.6/src/datagraphs/utils.py +325 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
Copyright (c) 2026 Data Language
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: pydatagraphs
|
|
3
|
+
Version: 0.4.6
|
|
4
|
+
Summary: Datagraphs python client
|
|
5
|
+
Keywords: datagraphs,knowledge-graph,api-client,linked-data
|
|
6
|
+
Author: DataGraphs
|
|
7
|
+
Author-email: DataGraphs <info@datagraphs.com>
|
|
8
|
+
License: The MIT License (MIT)
|
|
9
|
+
Copyright (c) 2026 Data Language
|
|
10
|
+
|
|
11
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
12
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
13
|
+
in the Software without restriction, including without limitation the rights
|
|
14
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
15
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
16
|
+
furnished to do so, subject to the following conditions:
|
|
17
|
+
|
|
18
|
+
The above copyright notice and this permission notice shall be included in all
|
|
19
|
+
copies or substantial portions of the Software.
|
|
20
|
+
|
|
21
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
22
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
23
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
24
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
25
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
26
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
27
|
+
SOFTWARE.
|
|
28
|
+
Classifier: Development Status :: 4 - Beta
|
|
29
|
+
Classifier: Intended Audience :: Developers
|
|
30
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
31
|
+
Classifier: Programming Language :: Python :: 3
|
|
32
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
34
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
35
|
+
Classifier: Typing :: Typed
|
|
36
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
37
|
+
Requires-Dist: requests>=2.32.4
|
|
38
|
+
Requires-Python: >=3.12
|
|
39
|
+
Project-URL: Changelog, https://github.com/datalanguage/datagraphs-client-py/blob/main/CHANGELOG.md
|
|
40
|
+
Project-URL: Homepage, https://datagraphs.com
|
|
41
|
+
Project-URL: Issues, https://github.com/datalanguage/datagraphs-client-py/issues
|
|
42
|
+
Project-URL: Repository, https://github.com/datalanguage/datagraphs-client-py
|
|
43
|
+
Description-Content-Type: text/markdown
|
|
44
|
+
|
|
45
|
+
# DataGraphs Python Client
|
|
46
|
+
|
|
47
|
+
Python client library for [DataGraphs](https://datagraphs.com).
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
uv add pydatagraphs
|
|
53
|
+
```
|
|
54
|
+
or
|
|
55
|
+
```bash
|
|
56
|
+
pip install pydatagraphs
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Quick starts
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from datagraphs import Client
|
|
63
|
+
|
|
64
|
+
# Connect to a project
|
|
65
|
+
client = Client(
|
|
66
|
+
project_name="my-project",
|
|
67
|
+
api_key="your-api-key",
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
# Check the API is reachable
|
|
71
|
+
print(client.status())
|
|
72
|
+
|
|
73
|
+
# Retrieve all entities of a given type
|
|
74
|
+
products = client.get("Product")
|
|
75
|
+
|
|
76
|
+
# Query with filters and pagination
|
|
77
|
+
results = client.query(q="Acme", page_size=50)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from datagraphs import Client, Gateway, Schema
|
|
82
|
+
|
|
83
|
+
# Connect to a project
|
|
84
|
+
client = Client(
|
|
85
|
+
project_name="my-project",
|
|
86
|
+
api_key="your-api-key",
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
# Read the project schema and dataset configurations
|
|
90
|
+
schema = client.get_schema()
|
|
91
|
+
schema = client.get_datasets()
|
|
92
|
+
|
|
93
|
+
# Update the project schema and dataset configurations
|
|
94
|
+
client.apply_schema(schema)
|
|
95
|
+
client.apply_datasets(datasets)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
from datagraphs import Client, Gateway, Dataset
|
|
100
|
+
|
|
101
|
+
# Connect to a project
|
|
102
|
+
client = Client(
|
|
103
|
+
project_name="my-project",
|
|
104
|
+
api_key="your-api-key",
|
|
105
|
+
)
|
|
106
|
+
gateway = Gateway(client, schema)
|
|
107
|
+
|
|
108
|
+
# Load / dump data via the Gateway
|
|
109
|
+
gateway.dump_data("./backup")
|
|
110
|
+
gateway.load_data(from_dir_path="./backup")
|
|
111
|
+
|
|
112
|
+
# Load / dump project via the Gateway
|
|
113
|
+
schema_output_path = "./schemas/"
|
|
114
|
+
datasets_output_path = "./datasets/"
|
|
115
|
+
gateway.dump_project(schema_output_path, datasets_output_path)
|
|
116
|
+
|
|
117
|
+
schema_data = load_json("./schemas/myproject-model-v1.0.json")
|
|
118
|
+
datasets_data = load_json("./datasets/myproject-datasets-v1.0.json")
|
|
119
|
+
schema = Schema.create_from(schema_data)
|
|
120
|
+
datasets = [Dataset.create_from(dataset) for dataset in datasets]
|
|
121
|
+
gateway.load_project(schema, datasets)
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
For full API documentation, please [see here](https://datalanguage.github.io/datagraphs-client-py)
|
|
125
|
+
|
|
126
|
+
## Authentication
|
|
127
|
+
|
|
128
|
+
For read-only access, an API key is sufficient. For write operations, supply OAuth credentials as well:
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
client = Client(
|
|
132
|
+
project_name="my-project",
|
|
133
|
+
api_key="your-api-key",
|
|
134
|
+
client_id="your-client-id",
|
|
135
|
+
client_secret="your-client-secret",
|
|
136
|
+
)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Key classes
|
|
140
|
+
|
|
141
|
+
| Class | Description |
|
|
142
|
+
|-------|-------------|
|
|
143
|
+
| `Client` | Lower-level HTTP client for the DataGraphs REST API |
|
|
144
|
+
| `Gateway` | Higher-level wrapper class for deploying projects and bulk export/load of data |
|
|
145
|
+
| `Schema` | In-memory representation of a project's domain model |
|
|
146
|
+
| `Dataset` | Represents a dataset within a project |
|
|
147
|
+
|
|
148
|
+
## Development
|
|
149
|
+
|
|
150
|
+
Install [uv](https://docs.astral.sh/uv/getting-started/installation/), then:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
uv sync # create virtualenv & install deps
|
|
154
|
+
uv run pytest tests -v # unit tests
|
|
155
|
+
uv run pytest tests_integration -v # integration tests
|
|
156
|
+
uv run pytest tests -v --capture=tee-sys # capturing stdout/stderr
|
|
157
|
+
uv run pytest --cov=src --cov-report=html # coverage report
|
|
158
|
+
uvx ruff check . # lint
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
[MIT](LICENSE) — Copyright (c) 2026 Data Language
|
|
164
|
+
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# DataGraphs Python Client
|
|
2
|
+
|
|
3
|
+
Python client library for [DataGraphs](https://datagraphs.com).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
uv add pydatagraphs
|
|
9
|
+
```
|
|
10
|
+
or
|
|
11
|
+
```bash
|
|
12
|
+
pip install pydatagraphs
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick starts
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
from datagraphs import Client
|
|
19
|
+
|
|
20
|
+
# Connect to a project
|
|
21
|
+
client = Client(
|
|
22
|
+
project_name="my-project",
|
|
23
|
+
api_key="your-api-key",
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
# Check the API is reachable
|
|
27
|
+
print(client.status())
|
|
28
|
+
|
|
29
|
+
# Retrieve all entities of a given type
|
|
30
|
+
products = client.get("Product")
|
|
31
|
+
|
|
32
|
+
# Query with filters and pagination
|
|
33
|
+
results = client.query(q="Acme", page_size=50)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from datagraphs import Client, Gateway, Schema
|
|
38
|
+
|
|
39
|
+
# Connect to a project
|
|
40
|
+
client = Client(
|
|
41
|
+
project_name="my-project",
|
|
42
|
+
api_key="your-api-key",
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
# Read the project schema and dataset configurations
|
|
46
|
+
schema = client.get_schema()
|
|
47
|
+
schema = client.get_datasets()
|
|
48
|
+
|
|
49
|
+
# Update the project schema and dataset configurations
|
|
50
|
+
client.apply_schema(schema)
|
|
51
|
+
client.apply_datasets(datasets)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from datagraphs import Client, Gateway, Dataset
|
|
56
|
+
|
|
57
|
+
# Connect to a project
|
|
58
|
+
client = Client(
|
|
59
|
+
project_name="my-project",
|
|
60
|
+
api_key="your-api-key",
|
|
61
|
+
)
|
|
62
|
+
gateway = Gateway(client, schema)
|
|
63
|
+
|
|
64
|
+
# Load / dump data via the Gateway
|
|
65
|
+
gateway.dump_data("./backup")
|
|
66
|
+
gateway.load_data(from_dir_path="./backup")
|
|
67
|
+
|
|
68
|
+
# Load / dump project via the Gateway
|
|
69
|
+
schema_output_path = "./schemas/"
|
|
70
|
+
datasets_output_path = "./datasets/"
|
|
71
|
+
gateway.dump_project(schema_output_path, datasets_output_path)
|
|
72
|
+
|
|
73
|
+
schema_data = load_json("./schemas/myproject-model-v1.0.json")
|
|
74
|
+
datasets_data = load_json("./datasets/myproject-datasets-v1.0.json")
|
|
75
|
+
schema = Schema.create_from(schema_data)
|
|
76
|
+
datasets = [Dataset.create_from(dataset) for dataset in datasets]
|
|
77
|
+
gateway.load_project(schema, datasets)
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
For full API documentation, please [see here](https://datalanguage.github.io/datagraphs-client-py)
|
|
81
|
+
|
|
82
|
+
## Authentication
|
|
83
|
+
|
|
84
|
+
For read-only access, an API key is sufficient. For write operations, supply OAuth credentials as well:
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
client = Client(
|
|
88
|
+
project_name="my-project",
|
|
89
|
+
api_key="your-api-key",
|
|
90
|
+
client_id="your-client-id",
|
|
91
|
+
client_secret="your-client-secret",
|
|
92
|
+
)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Key classes
|
|
96
|
+
|
|
97
|
+
| Class | Description |
|
|
98
|
+
|-------|-------------|
|
|
99
|
+
| `Client` | Lower-level HTTP client for the DataGraphs REST API |
|
|
100
|
+
| `Gateway` | Higher-level wrapper class for deploying projects and bulk export/load of data |
|
|
101
|
+
| `Schema` | In-memory representation of a project's domain model |
|
|
102
|
+
| `Dataset` | Represents a dataset within a project |
|
|
103
|
+
|
|
104
|
+
## Development
|
|
105
|
+
|
|
106
|
+
Install [uv](https://docs.astral.sh/uv/getting-started/installation/), then:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
uv sync # create virtualenv & install deps
|
|
110
|
+
uv run pytest tests -v # unit tests
|
|
111
|
+
uv run pytest tests_integration -v # integration tests
|
|
112
|
+
uv run pytest tests -v --capture=tee-sys # capturing stdout/stderr
|
|
113
|
+
uv run pytest --cov=src --cov-report=html # coverage report
|
|
114
|
+
uvx ruff check . # lint
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
[MIT](LICENSE) — Copyright (c) 2026 Data Language
|
|
120
|
+
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["uv_build>=0.7.2,<0.8"]
|
|
3
|
+
build-backend = "uv_build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pydatagraphs"
|
|
7
|
+
version = "0.4.6"
|
|
8
|
+
description = "Datagraphs python client"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { file = "LICENSE" }
|
|
11
|
+
requires-python = ">=3.12"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "DataGraphs", email = "info@datagraphs.com" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["datagraphs", "knowledge-graph", "api-client", "linked-data"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
24
|
+
"Typing :: Typed",
|
|
25
|
+
]
|
|
26
|
+
dependencies = [
|
|
27
|
+
"pyyaml>=6.0.3",
|
|
28
|
+
"requests>=2.32.4",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://datagraphs.com"
|
|
33
|
+
Repository = "https://github.com/datalanguage/datagraphs-client-py"
|
|
34
|
+
Issues = "https://github.com/datalanguage/datagraphs-client-py/issues"
|
|
35
|
+
Changelog = "https://github.com/datalanguage/datagraphs-client-py/blob/main/CHANGELOG.md"
|
|
36
|
+
|
|
37
|
+
[dependency-groups]
|
|
38
|
+
dev = [
|
|
39
|
+
"pydoctor>=25.10.1",
|
|
40
|
+
"pytest>=8.4.1",
|
|
41
|
+
"pytest-cov>=7.0.0",
|
|
42
|
+
"pytest-mock>=3.15.1",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[tool.uv.build-backend]
|
|
46
|
+
module-name = "datagraphs"
|
|
47
|
+
|
|
48
|
+
[tool.pytest.ini_options]
|
|
49
|
+
pythonpath = [
|
|
50
|
+
"src"
|
|
51
|
+
]
|
|
52
|
+
addopts = "-ra -q"
|
|
53
|
+
testpaths = [
|
|
54
|
+
"tests",
|
|
55
|
+
"tests_integration"
|
|
56
|
+
]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""DataGraphs Python client library."""
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import version
|
|
4
|
+
from datagraphs.client import Client, AuthenticationError, DatagraphsError
|
|
5
|
+
from datagraphs.gateway import Gateway
|
|
6
|
+
from datagraphs.schema import Schema
|
|
7
|
+
from datagraphs.dataset import Dataset
|
|
8
|
+
|
|
9
|
+
__version__ = version("pydatagraphs")
|
|
10
|
+
"""The installed version of the pydatagraphs package, read from package metadata."""
|
|
11
|
+
|
|
12
|
+
__all__ = [
|
|
13
|
+
"Client",
|
|
14
|
+
"Gateway",
|
|
15
|
+
"Schema",
|
|
16
|
+
"Dataset",
|
|
17
|
+
"AuthenticationError",
|
|
18
|
+
"DatagraphsError",
|
|
19
|
+
"__version__",
|
|
20
|
+
]
|