datacrunch 1.16.0__py3-none-any.whl → 1.17.2__py3-none-any.whl

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 (49) hide show
  1. datacrunch/InferenceClient/__init__.py +1 -1
  2. datacrunch/InferenceClient/inference_client.py +1 -514
  3. datacrunch/__init__.py +52 -2
  4. datacrunch/authentication.py +1 -0
  5. datacrunch/balance.py +1 -0
  6. datacrunch/constants.py +1 -109
  7. datacrunch/containers.py +1 -0
  8. datacrunch/datacrunch.py +44 -81
  9. datacrunch/exceptions.py +1 -29
  10. datacrunch/helpers.py +1 -18
  11. datacrunch/http_client.py +1 -0
  12. datacrunch/images.py +1 -0
  13. datacrunch/instance_types.py +1 -0
  14. datacrunch/instances.py +1 -0
  15. datacrunch/locations.py +1 -0
  16. datacrunch/ssh_keys.py +1 -0
  17. datacrunch/startup_scripts.py +1 -0
  18. datacrunch/volume_types.py +1 -0
  19. datacrunch/volumes.py +1 -0
  20. datacrunch-1.17.2.dist-info/METADATA +30 -0
  21. datacrunch-1.17.2.dist-info/RECORD +22 -0
  22. {datacrunch-1.16.0.dist-info → datacrunch-1.17.2.dist-info}/WHEEL +1 -1
  23. datacrunch/_version.py +0 -6
  24. datacrunch/authentication/__init__.py +0 -0
  25. datacrunch/authentication/authentication.py +0 -105
  26. datacrunch/balance/__init__.py +0 -0
  27. datacrunch/balance/balance.py +0 -50
  28. datacrunch/containers/__init__.py +0 -33
  29. datacrunch/containers/containers.py +0 -1109
  30. datacrunch/http_client/__init__.py +0 -0
  31. datacrunch/http_client/http_client.py +0 -241
  32. datacrunch/images/__init__.py +0 -0
  33. datacrunch/images/images.py +0 -93
  34. datacrunch/instance_types/__init__.py +0 -0
  35. datacrunch/instance_types/instance_types.py +0 -195
  36. datacrunch/instances/__init__.py +0 -0
  37. datacrunch/instances/instances.py +0 -259
  38. datacrunch/locations/__init__.py +0 -0
  39. datacrunch/locations/locations.py +0 -15
  40. datacrunch/ssh_keys/__init__.py +0 -0
  41. datacrunch/ssh_keys/ssh_keys.py +0 -111
  42. datacrunch/startup_scripts/__init__.py +0 -0
  43. datacrunch/startup_scripts/startup_scripts.py +0 -115
  44. datacrunch/volume_types/__init__.py +0 -0
  45. datacrunch/volume_types/volume_types.py +0 -68
  46. datacrunch/volumes/__init__.py +0 -0
  47. datacrunch/volumes/volumes.py +0 -385
  48. datacrunch-1.16.0.dist-info/METADATA +0 -182
  49. datacrunch-1.16.0.dist-info/RECORD +0 -35
datacrunch/datacrunch.py CHANGED
@@ -1,81 +1,44 @@
1
- from datacrunch.authentication.authentication import AuthenticationService
2
- from datacrunch.balance.balance import BalanceService
3
- from datacrunch.http_client.http_client import HTTPClient
4
- from datacrunch.images.images import ImagesService
5
- from datacrunch.instance_types.instance_types import InstanceTypesService
6
- from datacrunch.instances.instances import InstancesService
7
- from datacrunch.ssh_keys.ssh_keys import SSHKeysService
8
- from datacrunch.startup_scripts.startup_scripts import StartupScriptsService
9
- from datacrunch.volume_types.volume_types import VolumeTypesService
10
- from datacrunch.volumes.volumes import VolumesService
11
- from datacrunch.containers.containers import ContainersService
12
- from datacrunch.constants import Constants
13
- from datacrunch.locations.locations import LocationsService
14
- from datacrunch._version import __version__
15
-
16
-
17
- class DataCrunchClient:
18
- """Client for interacting with DataCrunch's public API"""
19
-
20
- def __init__(
21
- self,
22
- client_id: str,
23
- client_secret: str,
24
- base_url: str = 'https://api.datacrunch.io/v1',
25
- inference_key: str = None,
26
- ) -> None:
27
- """The DataCrunch client
28
-
29
- :param client_id: client id
30
- :type client_id: str
31
- :param client_secret: client secret
32
- :type client_secret: str
33
- :param base_url: base url for all the endpoints, optional, defaults to "https://api.datacrunch.io/v1"
34
- :type base_url: str, optional
35
- :param inference_key: inference key, optional
36
- :type inference_key: str, optional
37
- """
38
-
39
- # Validate that client_id and client_secret are not empty
40
- if not client_id or not client_secret:
41
- raise ValueError('client_id and client_secret must be provided')
42
-
43
- # Constants
44
- self.constants: Constants = Constants(base_url, __version__)
45
- """Constants"""
46
-
47
- # Services
48
- self._authentication: AuthenticationService = AuthenticationService(
49
- client_id, client_secret, self.constants.base_url
50
- )
51
- self._http_client: HTTPClient = HTTPClient(self._authentication, self.constants.base_url)
52
-
53
- self.balance: BalanceService = BalanceService(self._http_client)
54
- """Balance service. Get client balance"""
55
-
56
- self.images: ImagesService = ImagesService(self._http_client)
57
- """Image service"""
58
-
59
- self.instance_types: InstanceTypesService = InstanceTypesService(self._http_client)
60
- """Instance type service"""
61
-
62
- self.instances: InstancesService = InstancesService(self._http_client)
63
- """Instances service. Deploy, delete, hibernate (etc) instances"""
64
-
65
- self.ssh_keys: SSHKeysService = SSHKeysService(self._http_client)
66
- """SSH keys service"""
67
-
68
- self.startup_scripts: StartupScriptsService = StartupScriptsService(self._http_client)
69
- """Startup Scripts service"""
70
-
71
- self.volume_types: VolumeTypesService = VolumeTypesService(self._http_client)
72
- """Volume type service"""
73
-
74
- self.volumes: VolumesService = VolumesService(self._http_client)
75
- """Volume service. Create, attach, detach, get, rename, delete volumes"""
76
-
77
- self.locations: LocationsService = LocationsService(self._http_client)
78
- """Locations service. Get locations"""
79
-
80
- self.containers: ContainersService = ContainersService(self._http_client, inference_key)
81
- """Containers service. Deploy, manage, and monitor container deployments"""
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
+ )
datacrunch/exceptions.py CHANGED
@@ -1,29 +1 @@
1
- class APIException(Exception):
2
- """This exception is raised if there was an error from datacrunch's API.
3
- Could be an invalid input, token etc.
4
-
5
- Raised when an API HTTP call response has a status code >= 400
6
- """
7
-
8
- def __init__(self, code: str, message: str) -> None:
9
- """
10
-
11
- :param code: error code
12
- :type code: str
13
- :param message: error message
14
- :type message: str
15
- """
16
- self.code = code
17
- """Error code. should be available in DataCrunchClient.error_codes"""
18
-
19
- self.message = message
20
- """Error message
21
- """
22
-
23
- def __str__(self) -> str:
24
- msg = ''
25
- if self.code:
26
- msg = f'error code: {self.code}\n'
27
-
28
- msg += f'message: {self.message}'
29
- return msg
1
+ from verda.exceptions import *
datacrunch/helpers.py CHANGED
@@ -1,18 +1 @@
1
- from typing import Type
2
- import json
3
-
4
-
5
- def stringify_class_object_properties(class_object: Type) -> str:
6
- """Generates a json string representation of a class object's properties and values
7
-
8
- :param class_object: An instance of a class
9
- :type class_object: Type
10
- :return: _description_
11
- :rtype: json string representation of a class object's properties and values
12
- """
13
- class_properties = {
14
- property: getattr(class_object, property, '')
15
- for property in class_object.__dir__()
16
- if property[:1] != '_' and type(getattr(class_object, property, '')).__name__ != 'method'
17
- }
18
- return json.dumps(class_properties, indent=2)
1
+ from verda.helpers import *
@@ -0,0 +1 @@
1
+ from verda.http_client import *
datacrunch/images.py ADDED
@@ -0,0 +1 @@
1
+ from verda.images import *
@@ -0,0 +1 @@
1
+ from verda.instance_types import *
@@ -0,0 +1 @@
1
+ from verda.instances import *
@@ -0,0 +1 @@
1
+ from verda.locations import *
datacrunch/ssh_keys.py ADDED
@@ -0,0 +1 @@
1
+ from verda.ssh_keys import *
@@ -0,0 +1 @@
1
+ from verda.startup_scripts import *
@@ -0,0 +1 @@
1
+ from verda.volume_types import *
datacrunch/volumes.py ADDED
@@ -0,0 +1 @@
1
+ from verda.volumes import *
@@ -0,0 +1,30 @@
1
+ Metadata-Version: 2.3
2
+ Name: datacrunch
3
+ Version: 1.17.2
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.2
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,22 @@
1
+ datacrunch/InferenceClient/__init__.py,sha256=qnRYgyFWLsjGyGAK9GKel50_8syuRb_WTrN1a3gUP1E,121
2
+ datacrunch/InferenceClient/inference_client.py,sha256=TK4oc7pQjwT6ftMah8VKrmTOfEzuZx1eGYgBQAact5g,53
3
+ datacrunch/__init__.py,sha256=LLVG36knotjujxtucyiuLyCagKOQHCtuwMxgWXPkAOg,1034
4
+ datacrunch/authentication.py,sha256=SKq4wOL4dxgjY3IDtNNILghVzD9pGIseEBa6vWRLO9I,35
5
+ datacrunch/balance.py,sha256=Z3rGerIGyDl_RHTJHx5dtLOOifklNo5vG2gVJ_vyqec,28
6
+ datacrunch/constants.py,sha256=e2vvNmrptTm5oa1b1YqM9wo_92ctsWgy540KuTaGjAQ,30
7
+ datacrunch/containers.py,sha256=8MBb7scJdoiZDiF1n1MWfleFg5sllc_z-NESXhBLA1Q,31
8
+ datacrunch/datacrunch.py,sha256=km7nY38skCriD4pfKsksTkvGeVUwWkMuQrzb-eQf0U8,1518
9
+ datacrunch/exceptions.py,sha256=NVFQkf1R3FgBRWHli0lTwSe3uSDwQZPqjLJMM8kjECM,31
10
+ datacrunch/helpers.py,sha256=EiK-Z15EJzlikhiaBJJhrgST-cuD-aRjw4svQlG82-k,28
11
+ datacrunch/http_client.py,sha256=97hjTHUID7k9YO5KibxbsWEC46Ekp9Ik3pIuHCD8Psk,32
12
+ datacrunch/images.py,sha256=NAvhX3QupmbXI9sd_cKY3EMyTjCCGs9WwzKgthmgs5k,27
13
+ datacrunch/instance_types.py,sha256=m4uVxx_hfK6fGhILy6Z9sxxdEHhwlq_ACp2MxALcSkI,35
14
+ datacrunch/instances.py,sha256=fPRBChYWgno_kgHcaYuc292fzZPKPATKs37Gjk6zzLM,30
15
+ datacrunch/locations.py,sha256=D-CRTZKXwpUXtk66o86yf9W-LeC3ioZ7u0q_Fu8uqrM,30
16
+ datacrunch/ssh_keys.py,sha256=fqaHv-9DN4NZiVUP5N98bxSF94FOk5dAdYYLA5yr078,29
17
+ datacrunch/startup_scripts.py,sha256=UDBEDoNFfxVdyda3I1m4JEnePbEfxVF8fhQJHTZStCY,36
18
+ datacrunch/volume_types.py,sha256=iwGJUrtSIEuZ56vpSQ5GJ04B5FhcJ-2i5KZkonE3W24,33
19
+ datacrunch/volumes.py,sha256=9XzQWhMYrzTLWwfRyuLxfyGb90Nj066NRek5jPeTqD4,28
20
+ datacrunch-1.17.2.dist-info/WHEEL,sha256=YUH1mBqsx8Dh2cQG2rlcuRYUhJddG9iClegy4IgnHik,79
21
+ datacrunch-1.17.2.dist-info/METADATA,sha256=yrLVBmTKlph7F9IYMWujeQRG4IPIjWvwVK9IBS_7a6o,1287
22
+ datacrunch-1.17.2.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: uv 0.9.5
2
+ Generator: uv 0.9.11
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
datacrunch/_version.py DELETED
@@ -1,6 +0,0 @@
1
- try:
2
- from importlib.metadata import version
3
-
4
- __version__ = version('datacrunch')
5
- except Exception:
6
- __version__ = '0.0.0+dev' # fallback for development
File without changes
@@ -1,105 +0,0 @@
1
- import requests
2
- import time
3
-
4
- from datacrunch.http_client.http_client import handle_error
5
-
6
- TOKEN_ENDPOINT = '/oauth2/token'
7
-
8
- CLIENT_CREDENTIALS = 'client_credentials'
9
- REFRESH_TOKEN = 'refresh_token'
10
-
11
-
12
- class AuthenticationService:
13
- """A service for client authentication"""
14
-
15
- def __init__(self, client_id: str, client_secret: str, base_url: str) -> None:
16
- self._base_url = base_url
17
- self._client_id = client_id
18
- self._client_secret = client_secret
19
-
20
- def authenticate(self) -> dict:
21
- """Authenticate the client and store the access & refresh tokens
22
-
23
- returns an authentication data dictionary with the following schema:
24
- {
25
- "access_token": token str,
26
- "refresh_token": token str,
27
- "scope": scope str,
28
- "token_type": token type str,
29
- "expires_in": duration until expires in seconds
30
- }
31
-
32
- :return: authentication data (tokens, scope, token type, expires in)
33
- :rtype: dict
34
- """
35
- url = self._base_url + TOKEN_ENDPOINT
36
- payload = {
37
- 'grant_type': CLIENT_CREDENTIALS,
38
- 'client_id': self._client_id,
39
- 'client_secret': self._client_secret,
40
- }
41
-
42
- response = requests.post(url, json=payload, headers=self._generate_headers())
43
- handle_error(response)
44
-
45
- auth_data = response.json()
46
-
47
- self._access_token = auth_data['access_token']
48
- self._refresh_token = auth_data['refresh_token']
49
- self._scope = auth_data['scope']
50
- self._token_type = auth_data['token_type']
51
- self._expires_at = time.time() + auth_data['expires_in']
52
-
53
- return auth_data
54
-
55
- def refresh(self) -> dict:
56
- """Authenticate the client using the refresh token - refresh the access token.
57
-
58
- updates the object's tokens, and:
59
- returns an authentication data dictionary with the following schema:
60
- {
61
- "access_token": token str,
62
- "refresh_token": token str,
63
- "scope": scope str,
64
- "token_type": token type str,
65
- "expires_in": duration until expires in seconds
66
- }
67
-
68
- :return: authentication data (tokens, scope, token type, expires in)
69
- :rtype: dict
70
- """
71
- url = self._base_url + TOKEN_ENDPOINT
72
-
73
- payload = {'grant_type': REFRESH_TOKEN, 'refresh_token': self._refresh_token}
74
-
75
- response = requests.post(url, json=payload, headers=self._generate_headers())
76
-
77
- # if refresh token is also expired, authenticate again:
78
- if response.status_code == 401 or response.status_code == 400:
79
- return self.authenticate()
80
- else:
81
- handle_error(response)
82
-
83
- auth_data = response.json()
84
-
85
- self._access_token = auth_data['access_token']
86
- self._refresh_token = auth_data['refresh_token']
87
- self._scope = auth_data['scope']
88
- self._token_type = auth_data['token_type']
89
- self._expires_at = time.time() + auth_data['expires_in']
90
-
91
- return auth_data
92
-
93
- def _generate_headers(self):
94
- # get the first 10 chars of the client id
95
- client_id_truncated = self._client_id[:10]
96
- headers = {'User-Agent': 'datacrunch-python-' + client_id_truncated}
97
- return headers
98
-
99
- def is_expired(self) -> bool:
100
- """Returns true if the access token is expired.
101
-
102
- :return: True if the access token is expired, otherwise False.
103
- :rtype: bool
104
- """
105
- return time.time() >= self._expires_at
File without changes
@@ -1,50 +0,0 @@
1
- BALANCE_ENDPOINT = '/balance'
2
-
3
-
4
- class Balance:
5
- """A balance model class"""
6
-
7
- def __init__(self, amount: float, currency: str) -> None:
8
- """Initialize a new Balance object
9
-
10
- :param amount: Balance amount
11
- :type amount: float
12
- :param currency: currency code
13
- :type currency: str
14
- """
15
- self._amount = amount
16
- self._currency = currency
17
-
18
- @property
19
- def amount(self) -> float:
20
- """Get the balance amount
21
-
22
- :return: amount
23
- :rtype: float
24
- """
25
- return self._amount
26
-
27
- @property
28
- def currency(self) -> str:
29
- """Get the currency code
30
-
31
- :return: currency code
32
- :rtype: str
33
- """
34
- return self._currency
35
-
36
-
37
- class BalanceService:
38
- """A service for interacting with the balance endpoint"""
39
-
40
- def __init__(self, http_client) -> None:
41
- self._http_client = http_client
42
-
43
- def get(self) -> Balance:
44
- """Get the client's current balance
45
-
46
- :return: Balance object containing the amount and currency.
47
- :rtype: Balance
48
- """
49
- balance = self._http_client.get(BALANCE_ENDPOINT).json()
50
- return Balance(balance['amount'], balance['currency'])
@@ -1,33 +0,0 @@
1
- from .containers import (
2
- EnvVar,
3
- EnvVarType,
4
- ContainerRegistryType,
5
- ContainerDeploymentStatus,
6
- HealthcheckSettings,
7
- EntrypointOverridesSettings,
8
- VolumeMount,
9
- SecretMount,
10
- SharedFileSystemMount,
11
- GeneralStorageMount,
12
- VolumeMountType,
13
- Container,
14
- ContainerRegistryCredentials,
15
- ContainerRegistrySettings,
16
- ComputeResource,
17
- ScalingPolicy,
18
- QueueLoadScalingTrigger,
19
- UtilizationScalingTrigger,
20
- ScalingTriggers,
21
- ScalingOptions,
22
- Deployment,
23
- ReplicaInfo,
24
- Secret,
25
- RegistryCredential,
26
- ContainersService,
27
- BaseRegistryCredentials,
28
- DockerHubCredentials,
29
- GithubCredentials,
30
- GCRCredentials,
31
- AWSECRCredentials,
32
- CustomRegistryCredentials,
33
- )