datacrunch 1.16.0__tar.gz → 1.17.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.
- datacrunch-1.17.1/PKG-INFO +30 -0
- datacrunch-1.17.1/README.md +5 -0
- datacrunch-1.17.1/datacrunch/__init__.py +53 -0
- datacrunch-1.17.1/datacrunch/datacrunch.py +44 -0
- datacrunch-1.17.1/pyproject.toml +49 -0
- datacrunch-1.16.0/PKG-INFO +0 -182
- datacrunch-1.16.0/README.md +0 -157
- datacrunch-1.16.0/datacrunch/InferenceClient/__init__.py +0 -3
- datacrunch-1.16.0/datacrunch/InferenceClient/inference_client.py +0 -514
- datacrunch-1.16.0/datacrunch/__init__.py +0 -3
- datacrunch-1.16.0/datacrunch/_version.py +0 -6
- datacrunch-1.16.0/datacrunch/authentication/__init__.py +0 -0
- datacrunch-1.16.0/datacrunch/authentication/authentication.py +0 -105
- datacrunch-1.16.0/datacrunch/balance/__init__.py +0 -0
- datacrunch-1.16.0/datacrunch/balance/balance.py +0 -50
- datacrunch-1.16.0/datacrunch/constants.py +0 -109
- datacrunch-1.16.0/datacrunch/containers/__init__.py +0 -33
- datacrunch-1.16.0/datacrunch/containers/containers.py +0 -1109
- datacrunch-1.16.0/datacrunch/datacrunch.py +0 -81
- datacrunch-1.16.0/datacrunch/exceptions.py +0 -29
- datacrunch-1.16.0/datacrunch/helpers.py +0 -18
- datacrunch-1.16.0/datacrunch/http_client/__init__.py +0 -0
- datacrunch-1.16.0/datacrunch/http_client/http_client.py +0 -241
- datacrunch-1.16.0/datacrunch/images/__init__.py +0 -0
- datacrunch-1.16.0/datacrunch/images/images.py +0 -93
- datacrunch-1.16.0/datacrunch/instance_types/__init__.py +0 -0
- datacrunch-1.16.0/datacrunch/instance_types/instance_types.py +0 -195
- datacrunch-1.16.0/datacrunch/instances/__init__.py +0 -0
- datacrunch-1.16.0/datacrunch/instances/instances.py +0 -259
- datacrunch-1.16.0/datacrunch/locations/__init__.py +0 -0
- datacrunch-1.16.0/datacrunch/locations/locations.py +0 -15
- datacrunch-1.16.0/datacrunch/ssh_keys/__init__.py +0 -0
- datacrunch-1.16.0/datacrunch/ssh_keys/ssh_keys.py +0 -111
- datacrunch-1.16.0/datacrunch/startup_scripts/__init__.py +0 -0
- datacrunch-1.16.0/datacrunch/startup_scripts/startup_scripts.py +0 -115
- datacrunch-1.16.0/datacrunch/volume_types/__init__.py +0 -0
- datacrunch-1.16.0/datacrunch/volume_types/volume_types.py +0 -68
- datacrunch-1.16.0/datacrunch/volumes/__init__.py +0 -0
- datacrunch-1.16.0/datacrunch/volumes/volumes.py +0 -385
- datacrunch-1.16.0/pyproject.toml +0 -56
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: datacrunch
|
|
3
|
+
Version: 1.17.1
|
|
4
|
+
Summary: datacrunch is now verda
|
|
5
|
+
Author: Verda Cloud Oy
|
|
6
|
+
Author-email: Verda Cloud Oy <info@verda.com>
|
|
7
|
+
Classifier: Development Status :: 7 - Inactive
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Natural Language :: English
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Requires-Dist: verda==1.17.1
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Project-URL: Changelog, https://github.com/verda-cloud/sdk-python/blob/master/CHANGELOG.md
|
|
21
|
+
Project-URL: Documentation, https://datacrunch-python.readthedocs.io/
|
|
22
|
+
Project-URL: Homepage, https://github.com/verda-cloud
|
|
23
|
+
Project-URL: Repository, https://github.com/verda-cloud/sdk-python
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# datacrunch is now verda
|
|
27
|
+
|
|
28
|
+
This package has been [renamed](https://verda.com/blog/datacrunch-is-changing-its-name-to-verda). Use `pip install verda` or `uv add verda` instead.
|
|
29
|
+
|
|
30
|
+
New package: https://pypi.org/project/verda/
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Compatibility layer for deprecated `datacrunch` package
|
|
2
|
+
|
|
3
|
+
from verda import (
|
|
4
|
+
InferenceClient,
|
|
5
|
+
__version__,
|
|
6
|
+
authentication,
|
|
7
|
+
balance,
|
|
8
|
+
constants,
|
|
9
|
+
containers,
|
|
10
|
+
exceptions,
|
|
11
|
+
helpers,
|
|
12
|
+
http_client,
|
|
13
|
+
images,
|
|
14
|
+
instance_types,
|
|
15
|
+
instances,
|
|
16
|
+
locations,
|
|
17
|
+
ssh_keys,
|
|
18
|
+
startup_scripts,
|
|
19
|
+
volume_types,
|
|
20
|
+
volumes,
|
|
21
|
+
)
|
|
22
|
+
from verda import VerdaClient as DataCrunchClient
|
|
23
|
+
|
|
24
|
+
# For old `from datacrunch import *``
|
|
25
|
+
__all__ = [
|
|
26
|
+
'DataCrunchClient',
|
|
27
|
+
'InferenceClient',
|
|
28
|
+
'__version__',
|
|
29
|
+
'authentication',
|
|
30
|
+
'balance',
|
|
31
|
+
'constants',
|
|
32
|
+
'containers',
|
|
33
|
+
'datacrunch',
|
|
34
|
+
'exceptions',
|
|
35
|
+
'helpers',
|
|
36
|
+
'http_client',
|
|
37
|
+
'images',
|
|
38
|
+
'instance_types',
|
|
39
|
+
'instances',
|
|
40
|
+
'locations',
|
|
41
|
+
'ssh_keys',
|
|
42
|
+
'startup_scripts',
|
|
43
|
+
'volume_types',
|
|
44
|
+
'volumes',
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
import warnings
|
|
48
|
+
|
|
49
|
+
warnings.warn(
|
|
50
|
+
'datacrunch is deprecated; use verda package instead: https://github.com/verda-cloud/sdk-python/blob/master/CHANGELOG.md#1170---2025-11-26',
|
|
51
|
+
DeprecationWarning,
|
|
52
|
+
stacklevel=2,
|
|
53
|
+
)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Compatibility layer for deprecated `datacrunch.datacrunch` package
|
|
2
|
+
|
|
3
|
+
from verda import VerdaClient as DataCrunchClient
|
|
4
|
+
from verda._version import __version__
|
|
5
|
+
from verda.authentication.authentication import AuthenticationService
|
|
6
|
+
from verda.balance.balance import BalanceService
|
|
7
|
+
from verda.constants import Constants
|
|
8
|
+
from verda.containers.containers import ContainersService
|
|
9
|
+
from verda.http_client.http_client import HTTPClient
|
|
10
|
+
from verda.images.images import ImagesService
|
|
11
|
+
from verda.instance_types.instance_types import InstanceTypesService
|
|
12
|
+
from verda.instances.instances import InstancesService
|
|
13
|
+
from verda.locations.locations import LocationsService
|
|
14
|
+
from verda.ssh_keys.ssh_keys import SSHKeysService
|
|
15
|
+
from verda.startup_scripts.startup_scripts import StartupScriptsService
|
|
16
|
+
from verda.volume_types.volume_types import VolumeTypesService
|
|
17
|
+
from verda.volumes.volumes import VolumesService
|
|
18
|
+
|
|
19
|
+
# for `from datacrunch.datacrunch import *`
|
|
20
|
+
__all__ = [
|
|
21
|
+
'AuthenticationService',
|
|
22
|
+
'BalanceService',
|
|
23
|
+
'Constants',
|
|
24
|
+
'ContainersService',
|
|
25
|
+
'DataCrunchClient',
|
|
26
|
+
'HTTPClient',
|
|
27
|
+
'ImagesService',
|
|
28
|
+
'InstanceTypesService',
|
|
29
|
+
'InstancesService',
|
|
30
|
+
'LocationsService',
|
|
31
|
+
'SSHKeysService',
|
|
32
|
+
'StartupScriptsService',
|
|
33
|
+
'VolumeTypesService',
|
|
34
|
+
'VolumesService',
|
|
35
|
+
'__version__',
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
import warnings
|
|
39
|
+
|
|
40
|
+
warnings.warn(
|
|
41
|
+
'datacrunch is deprecated; use verda package instead: https://github.com/verda-cloud/sdk-python/blob/master/CHANGELOG.md#1170---2025-11-26',
|
|
42
|
+
DeprecationWarning,
|
|
43
|
+
stacklevel=2,
|
|
44
|
+
)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "datacrunch"
|
|
3
|
+
version = "1.17.1" # version will be set by .github/workflows/publish.yml before release
|
|
4
|
+
description = "datacrunch is now verda"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
|
|
8
|
+
authors = [{ name = "Verda Cloud Oy", email = "info@verda.com" }]
|
|
9
|
+
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 7 - Inactive",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"License :: OSI Approved :: MIT License",
|
|
14
|
+
"Natural Language :: English",
|
|
15
|
+
"Operating System :: OS Independent",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.10",
|
|
18
|
+
"Programming Language :: Python :: 3.11",
|
|
19
|
+
"Programming Language :: Python :: 3.12",
|
|
20
|
+
"Programming Language :: Python :: 3.13",
|
|
21
|
+
"Programming Language :: Python :: 3.14",
|
|
22
|
+
]
|
|
23
|
+
dependencies = [
|
|
24
|
+
"verda==1.17.1",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.urls]
|
|
28
|
+
Homepage = "https://github.com/verda-cloud"
|
|
29
|
+
Documentation = "https://datacrunch-python.readthedocs.io/"
|
|
30
|
+
Repository = "https://github.com/verda-cloud/sdk-python"
|
|
31
|
+
Changelog = "https://github.com/verda-cloud/sdk-python/blob/master/CHANGELOG.md"
|
|
32
|
+
|
|
33
|
+
[build-system]
|
|
34
|
+
requires = ["uv_build>=0.9.5,<0.10.0"]
|
|
35
|
+
build-backend = "uv_build"
|
|
36
|
+
|
|
37
|
+
[tool.uv.build-backend]
|
|
38
|
+
module-name = "datacrunch"
|
|
39
|
+
module-root = ""
|
|
40
|
+
|
|
41
|
+
[tool.uv.sources]
|
|
42
|
+
verda = { workspace = true }
|
|
43
|
+
|
|
44
|
+
[dependency-groups]
|
|
45
|
+
dev = [
|
|
46
|
+
"pytest>=8.1,<9",
|
|
47
|
+
"pytest-responses>=0.5.1",
|
|
48
|
+
"responses>=0.25.8",
|
|
49
|
+
]
|
datacrunch-1.16.0/PKG-INFO
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: datacrunch
|
|
3
|
-
Version: 1.16.0
|
|
4
|
-
Summary: Official Python SDK for DataCrunch Public API
|
|
5
|
-
Author: DataCrunch Oy
|
|
6
|
-
Author-email: DataCrunch Oy <info@datacrunch.io>
|
|
7
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
8
|
-
Classifier: Intended Audience :: Developers
|
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
-
Classifier: Natural Language :: English
|
|
11
|
-
Classifier: Operating System :: OS Independent
|
|
12
|
-
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
-
Requires-Dist: requests>=2.25.1,<3
|
|
18
|
-
Requires-Dist: dataclasses-json>=0.6.7
|
|
19
|
-
Requires-Python: >=3.11
|
|
20
|
-
Project-URL: Changelog, https://datacrunch-python.readthedocs.io/en/latest/changelog.html
|
|
21
|
-
Project-URL: Documentation, https://datacrunch-python.readthedocs.io/
|
|
22
|
-
Project-URL: Homepage, https://github.com/DataCrunch-io
|
|
23
|
-
Project-URL: Repository, https://github.com/DataCrunch-io/datacrunch-python
|
|
24
|
-
Description-Content-Type: text/markdown
|
|
25
|
-
|
|
26
|
-
# DataCrunch Python SDK
|
|
27
|
-
|
|
28
|
-
[<img src='https://github.com/DataCrunch-io/datacrunch-python/workflows/Unit%20Tests/badge.svg'>](https://github.com/DataCrunch-io/datacrunch-python/actions?query=workflow%3A%22Unit+Tests%22+branch%3Amaster)
|
|
29
|
-
[<img src='https://github.com/DataCrunch-io/datacrunch-python/workflows/Code%20Style/badge.svg'>](https://github.com/DataCrunch-io/datacrunch-python/actions?query=workflow%3A%22Code+Style%22+branch%3Amaster)
|
|
30
|
-
[<img src="https://codecov.io/gh/DataCrunch-io/datacrunch-python/branch/master/graph/badge.svg?token=5X5KTYSSPK">](https://codecov.io/gh/DataCrunch-io/datacrunch-python)
|
|
31
|
-
[<img src='https://readthedocs.org/projects/datacrunch-python/badge/?version=latest'>](https://datacrunch-python.readthedocs.io/en/latest/)
|
|
32
|
-
[<img src='https://img.shields.io/github/license/DataCrunch-io/datacrunch-python'>](https://github.com/DataCrunch-io/datacrunch-python/blob/master/LICENSE)
|
|
33
|
-
[<img src='https://img.shields.io/pypi/v/datacrunch?logo=python'>](https://pypi.org/project/datacrunch/)
|
|
34
|
-
[<img src='https://img.shields.io/pypi/pyversions/datacrunch'>](https://pypi.org/project/datacrunch/)
|
|
35
|
-
|
|
36
|
-
The official [DataCrunch.io](https://datacrunch.io) Python SDK.
|
|
37
|
-
|
|
38
|
-
The SDK's documentation is available on [ReadTheDocs](https://datacrunch-python.readthedocs.io/en/latest/)
|
|
39
|
-
|
|
40
|
-
DataCrunch's Public API documentation [is available here](https://api.datacrunch.io/v1/docs).
|
|
41
|
-
|
|
42
|
-
## Getting Started - Using the SDK:
|
|
43
|
-
|
|
44
|
-
- Install:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
# via pip
|
|
48
|
-
pip3 install datacrunch
|
|
49
|
-
|
|
50
|
-
# via uv
|
|
51
|
-
uv add datacrunch
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
- Generate your client credentials - [instructions in the public API docs](https://api.datacrunch.io/v1/docs#description/quick-start-guide).
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
- Add your client id and client secret to an environment variable (don't want it to be hardcoded):
|
|
58
|
-
|
|
59
|
-
Linux (bash):
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
export DATACRUNCH_CLIENT_ID=YOUR_ID_HERE
|
|
63
|
-
export DATACRUNCH_CLIENT_SECRET=YOUR_SECRET_HERE
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
- To enable sending inference requests from SDK you must generate an inference key - [Instructions on inference authorization](https://docs.datacrunch.io/inference/authorization)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
- Add your inference key to an environment variable
|
|
70
|
-
|
|
71
|
-
Linux (bash):
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
export DATACRUNCH_INFERENCE_KEY=YOUR_API_KEY_HERE
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Other platforms:
|
|
78
|
-
https://en.wikipedia.org/wiki/Environment_variable
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
- Example for creating a new instance:
|
|
83
|
-
|
|
84
|
-
```python
|
|
85
|
-
import os
|
|
86
|
-
from datacrunch import DataCrunchClient
|
|
87
|
-
|
|
88
|
-
# Get credentials from environment variables
|
|
89
|
-
CLIENT_ID = os.environ.get('DATACRUNCH_CLIENT_ID')
|
|
90
|
-
CLIENT_SECRET = os.environ['DATACRUNCH_CLIENT_SECRET']
|
|
91
|
-
|
|
92
|
-
# Create datcrunch client
|
|
93
|
-
datacrunch = DataCrunchClient(CLIENT_ID, CLIENT_SECRET)
|
|
94
|
-
|
|
95
|
-
# Get all SSH keys
|
|
96
|
-
ssh_keys = datacrunch.ssh_keys.get()
|
|
97
|
-
ssh_keys = list(map(lambda key: key.id, ssh_keys))
|
|
98
|
-
|
|
99
|
-
# Create a new instance
|
|
100
|
-
instance = datacrunch.instances.create(instance_type='1V100.6V',
|
|
101
|
-
image='ubuntu-24.04-cuda-12.8-open-docker',
|
|
102
|
-
ssh_key_ids=ssh_keys,
|
|
103
|
-
hostname='example',
|
|
104
|
-
description='example instance')
|
|
105
|
-
|
|
106
|
-
# Delete instance
|
|
107
|
-
datacrunch.instances.action(instance.id, datacrunch.constants.instance_actions.DELETE)
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
More examples can be found in the `/examples` folder or in the [documentation](https://datacrunch-python.readthedocs.io/en/latest/).
|
|
111
|
-
|
|
112
|
-
## Development
|
|
113
|
-
|
|
114
|
-
### Set up the local development environment
|
|
115
|
-
|
|
116
|
-
Prerequisite: install [`uv`](https://docs.astral.sh/uv/).
|
|
117
|
-
|
|
118
|
-
Clone the repository, create local environment and install dependencies:
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
git clone git@github.com:DataCrunch-io/datacrunch-python.git
|
|
122
|
-
cd datacrunch-python
|
|
123
|
-
uv sync
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### Run Tests
|
|
127
|
-
|
|
128
|
-
- Execute all tests
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
uv run pytest
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
- Execute a single test file
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
uv run pytest tests/unit_tests/test_file.py
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### Local Manual Testing
|
|
141
|
-
|
|
142
|
-
Create a file in the root directory of the project:
|
|
143
|
-
|
|
144
|
-
```python
|
|
145
|
-
# example.py
|
|
146
|
-
from datacrunch.datacrunch import DataCrunchClient
|
|
147
|
-
|
|
148
|
-
CLIENT_SECRET = 'secret'
|
|
149
|
-
CLIENT_ID = 'your-id'
|
|
150
|
-
|
|
151
|
-
# Create datacrunch client
|
|
152
|
-
datacrunch = DataCrunchClient(CLIENT_ID, CLIENT_SECRET, base_url='http://localhost:3001/v1')
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
Run it:
|
|
156
|
-
|
|
157
|
-
```bash
|
|
158
|
-
uv run python example.py
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Generating the documentation
|
|
162
|
-
|
|
163
|
-
If added a new service, create a documentation template under api/services for that service.
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
cd docs
|
|
167
|
-
make html
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### Code style
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
# Lint
|
|
174
|
-
uv run ruff check
|
|
175
|
-
|
|
176
|
-
# Format code
|
|
177
|
-
uv run ruff format
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
## Contact
|
|
181
|
-
|
|
182
|
-
You can [contact us here](https://datacrunch.io/contact), or open an issue in the repo.
|
datacrunch-1.16.0/README.md
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
# DataCrunch Python SDK
|
|
2
|
-
|
|
3
|
-
[<img src='https://github.com/DataCrunch-io/datacrunch-python/workflows/Unit%20Tests/badge.svg'>](https://github.com/DataCrunch-io/datacrunch-python/actions?query=workflow%3A%22Unit+Tests%22+branch%3Amaster)
|
|
4
|
-
[<img src='https://github.com/DataCrunch-io/datacrunch-python/workflows/Code%20Style/badge.svg'>](https://github.com/DataCrunch-io/datacrunch-python/actions?query=workflow%3A%22Code+Style%22+branch%3Amaster)
|
|
5
|
-
[<img src="https://codecov.io/gh/DataCrunch-io/datacrunch-python/branch/master/graph/badge.svg?token=5X5KTYSSPK">](https://codecov.io/gh/DataCrunch-io/datacrunch-python)
|
|
6
|
-
[<img src='https://readthedocs.org/projects/datacrunch-python/badge/?version=latest'>](https://datacrunch-python.readthedocs.io/en/latest/)
|
|
7
|
-
[<img src='https://img.shields.io/github/license/DataCrunch-io/datacrunch-python'>](https://github.com/DataCrunch-io/datacrunch-python/blob/master/LICENSE)
|
|
8
|
-
[<img src='https://img.shields.io/pypi/v/datacrunch?logo=python'>](https://pypi.org/project/datacrunch/)
|
|
9
|
-
[<img src='https://img.shields.io/pypi/pyversions/datacrunch'>](https://pypi.org/project/datacrunch/)
|
|
10
|
-
|
|
11
|
-
The official [DataCrunch.io](https://datacrunch.io) Python SDK.
|
|
12
|
-
|
|
13
|
-
The SDK's documentation is available on [ReadTheDocs](https://datacrunch-python.readthedocs.io/en/latest/)
|
|
14
|
-
|
|
15
|
-
DataCrunch's Public API documentation [is available here](https://api.datacrunch.io/v1/docs).
|
|
16
|
-
|
|
17
|
-
## Getting Started - Using the SDK:
|
|
18
|
-
|
|
19
|
-
- Install:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
# via pip
|
|
23
|
-
pip3 install datacrunch
|
|
24
|
-
|
|
25
|
-
# via uv
|
|
26
|
-
uv add datacrunch
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
- Generate your client credentials - [instructions in the public API docs](https://api.datacrunch.io/v1/docs#description/quick-start-guide).
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
- Add your client id and client secret to an environment variable (don't want it to be hardcoded):
|
|
33
|
-
|
|
34
|
-
Linux (bash):
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
export DATACRUNCH_CLIENT_ID=YOUR_ID_HERE
|
|
38
|
-
export DATACRUNCH_CLIENT_SECRET=YOUR_SECRET_HERE
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
- To enable sending inference requests from SDK you must generate an inference key - [Instructions on inference authorization](https://docs.datacrunch.io/inference/authorization)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
- Add your inference key to an environment variable
|
|
45
|
-
|
|
46
|
-
Linux (bash):
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
export DATACRUNCH_INFERENCE_KEY=YOUR_API_KEY_HERE
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Other platforms:
|
|
53
|
-
https://en.wikipedia.org/wiki/Environment_variable
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
- Example for creating a new instance:
|
|
58
|
-
|
|
59
|
-
```python
|
|
60
|
-
import os
|
|
61
|
-
from datacrunch import DataCrunchClient
|
|
62
|
-
|
|
63
|
-
# Get credentials from environment variables
|
|
64
|
-
CLIENT_ID = os.environ.get('DATACRUNCH_CLIENT_ID')
|
|
65
|
-
CLIENT_SECRET = os.environ['DATACRUNCH_CLIENT_SECRET']
|
|
66
|
-
|
|
67
|
-
# Create datcrunch client
|
|
68
|
-
datacrunch = DataCrunchClient(CLIENT_ID, CLIENT_SECRET)
|
|
69
|
-
|
|
70
|
-
# Get all SSH keys
|
|
71
|
-
ssh_keys = datacrunch.ssh_keys.get()
|
|
72
|
-
ssh_keys = list(map(lambda key: key.id, ssh_keys))
|
|
73
|
-
|
|
74
|
-
# Create a new instance
|
|
75
|
-
instance = datacrunch.instances.create(instance_type='1V100.6V',
|
|
76
|
-
image='ubuntu-24.04-cuda-12.8-open-docker',
|
|
77
|
-
ssh_key_ids=ssh_keys,
|
|
78
|
-
hostname='example',
|
|
79
|
-
description='example instance')
|
|
80
|
-
|
|
81
|
-
# Delete instance
|
|
82
|
-
datacrunch.instances.action(instance.id, datacrunch.constants.instance_actions.DELETE)
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
More examples can be found in the `/examples` folder or in the [documentation](https://datacrunch-python.readthedocs.io/en/latest/).
|
|
86
|
-
|
|
87
|
-
## Development
|
|
88
|
-
|
|
89
|
-
### Set up the local development environment
|
|
90
|
-
|
|
91
|
-
Prerequisite: install [`uv`](https://docs.astral.sh/uv/).
|
|
92
|
-
|
|
93
|
-
Clone the repository, create local environment and install dependencies:
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
git clone git@github.com:DataCrunch-io/datacrunch-python.git
|
|
97
|
-
cd datacrunch-python
|
|
98
|
-
uv sync
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### Run Tests
|
|
102
|
-
|
|
103
|
-
- Execute all tests
|
|
104
|
-
|
|
105
|
-
```bash
|
|
106
|
-
uv run pytest
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
- Execute a single test file
|
|
110
|
-
|
|
111
|
-
```bash
|
|
112
|
-
uv run pytest tests/unit_tests/test_file.py
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### Local Manual Testing
|
|
116
|
-
|
|
117
|
-
Create a file in the root directory of the project:
|
|
118
|
-
|
|
119
|
-
```python
|
|
120
|
-
# example.py
|
|
121
|
-
from datacrunch.datacrunch import DataCrunchClient
|
|
122
|
-
|
|
123
|
-
CLIENT_SECRET = 'secret'
|
|
124
|
-
CLIENT_ID = 'your-id'
|
|
125
|
-
|
|
126
|
-
# Create datacrunch client
|
|
127
|
-
datacrunch = DataCrunchClient(CLIENT_ID, CLIENT_SECRET, base_url='http://localhost:3001/v1')
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
Run it:
|
|
131
|
-
|
|
132
|
-
```bash
|
|
133
|
-
uv run python example.py
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### Generating the documentation
|
|
137
|
-
|
|
138
|
-
If added a new service, create a documentation template under api/services for that service.
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
cd docs
|
|
142
|
-
make html
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### Code style
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
# Lint
|
|
149
|
-
uv run ruff check
|
|
150
|
-
|
|
151
|
-
# Format code
|
|
152
|
-
uv run ruff format
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
## Contact
|
|
156
|
-
|
|
157
|
-
You can [contact us here](https://datacrunch.io/contact), or open an issue in the repo.
|