datalab-api 0.6.0__tar.gz → 0.7.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.
- {datalab_api-0.6.0/src/datalab_api.egg-info → datalab_api-0.7.0}/PKG-INFO +3 -3
- {datalab_api-0.6.0 → datalab_api-0.7.0}/pyproject.toml +8 -2
- {datalab_api-0.6.0 → datalab_api-0.7.0}/src/datalab_api/__init__.py +3 -3
- {datalab_api-0.6.0 → datalab_api-0.7.0}/src/datalab_api/_base.py +9 -9
- {datalab_api-0.6.0 → datalab_api-0.7.0/src/datalab_api.egg-info}/PKG-INFO +3 -3
- {datalab_api-0.6.0 → datalab_api-0.7.0}/src/datalab_api.egg-info/requires.txt +1 -1
- {datalab_api-0.6.0 → datalab_api-0.7.0}/tests/test_client.py +1 -1
- {datalab_api-0.6.0 → datalab_api-0.7.0}/LICENSE +0 -0
- {datalab_api-0.6.0 → datalab_api-0.7.0}/README.md +0 -0
- {datalab_api-0.6.0 → datalab_api-0.7.0}/setup.cfg +0 -0
- {datalab_api-0.6.0 → datalab_api-0.7.0}/src/datalab_api/cli.py +0 -0
- {datalab_api-0.6.0 → datalab_api-0.7.0}/src/datalab_api/utils.py +0 -0
- {datalab_api-0.6.0 → datalab_api-0.7.0}/src/datalab_api.egg-info/SOURCES.txt +0 -0
- {datalab_api-0.6.0 → datalab_api-0.7.0}/src/datalab_api.egg-info/dependency_links.txt +0 -0
- {datalab_api-0.6.0 → datalab_api-0.7.0}/src/datalab_api.egg-info/entry_points.txt +0 -0
- {datalab_api-0.6.0 → datalab_api-0.7.0}/src/datalab_api.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: datalab-api
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: A Python API for instances of the datalab data management platform (https://github.com/datalab-org/datalab).
|
|
5
5
|
Author-email: Matthew Evans <matthew@ml-evs.science>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -17,7 +17,7 @@ Classifier: Intended Audience :: Science/Research
|
|
|
17
17
|
Classifier: Intended Audience :: Information Technology
|
|
18
18
|
Classifier: Topic :: Other/Nonlisted Topic
|
|
19
19
|
Classifier: Topic :: Scientific/Engineering
|
|
20
|
-
Requires-Python: >=3.
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
License-File: LICENSE
|
|
23
23
|
Requires-Dist: httpx2~=2.13
|
|
@@ -29,7 +29,7 @@ Provides-Extra: networkx
|
|
|
29
29
|
Requires-Dist: networkx>=3; extra == "networkx"
|
|
30
30
|
Provides-Extra: dev
|
|
31
31
|
Requires-Dist: pre-commit<5,>=3; extra == "dev"
|
|
32
|
-
Requires-Dist: pytest~=
|
|
32
|
+
Requires-Dist: pytest~=9.0; extra == "dev"
|
|
33
33
|
Requires-Dist: pytest-cov<8,>=5; extra == "dev"
|
|
34
34
|
Requires-Dist: respx~=0.22; extra == "dev"
|
|
35
35
|
Provides-Extra: docs
|
|
@@ -22,7 +22,7 @@ classifiers = [
|
|
|
22
22
|
"Topic :: Scientific/Engineering",
|
|
23
23
|
]
|
|
24
24
|
|
|
25
|
-
requires-python = ">=3.
|
|
25
|
+
requires-python = ">=3.11"
|
|
26
26
|
dependencies = [
|
|
27
27
|
"httpx2 ~= 2.13", # better HTTP requests
|
|
28
28
|
"rich >= 13,< 15", # nicer terminal output
|
|
@@ -41,7 +41,7 @@ networkx = [
|
|
|
41
41
|
|
|
42
42
|
dev = [
|
|
43
43
|
"pre-commit >= 3,< 5",
|
|
44
|
-
"pytest ~=
|
|
44
|
+
"pytest ~= 9.0",
|
|
45
45
|
"pytest-cov >= 5,< 8",
|
|
46
46
|
"respx ~= 0.22",
|
|
47
47
|
]
|
|
@@ -71,12 +71,18 @@ documentation = "https://datalab-python-api.readthedocs.io"
|
|
|
71
71
|
changelog = "https://github.com/datalab-org/datalab-api/releases"
|
|
72
72
|
|
|
73
73
|
[tool.uv]
|
|
74
|
+
required-version = ">=0.9.8" # first release supporting exclude-dependencies; also used by setup-uv in CI
|
|
75
|
+
exclude-dependencies = ["httpx", "httpcore"]
|
|
74
76
|
cache-keys = [{ git = true }]
|
|
75
77
|
|
|
76
78
|
[tool.versioningit.vcs]
|
|
77
79
|
method = "git"
|
|
78
80
|
default-tag = "0.0.1"
|
|
79
81
|
|
|
82
|
+
[tool.pytest.ini_options]
|
|
83
|
+
# respx's plugin imports httpx at startup, before conftest can alias it to httpx2
|
|
84
|
+
addopts = "-p no:respx"
|
|
85
|
+
|
|
80
86
|
[tool.mypy]
|
|
81
87
|
# plugins = "pydantic.mypy"
|
|
82
88
|
ignore_missing_imports = true
|
|
@@ -5,7 +5,7 @@ from collections.abc import Iterable
|
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
from typing import TYPE_CHECKING, Any, Optional, Union
|
|
7
7
|
|
|
8
|
-
import
|
|
8
|
+
import httpx2
|
|
9
9
|
|
|
10
10
|
from ._base import BaseDatalabClient, DatalabAPIError, DuplicateItemError, __version__
|
|
11
11
|
from .utils import networkx_from_item_graph
|
|
@@ -398,7 +398,7 @@ class DatalabClient(BaseDatalabClient):
|
|
|
398
398
|
|
|
399
399
|
# Use a longer read timeout for uploads, as the server may do
|
|
400
400
|
# significant processing before responding
|
|
401
|
-
upload_timeout =
|
|
401
|
+
upload_timeout = httpx2.Timeout(self._timeout.connect, read=600.0, pool=self._timeout.pool)
|
|
402
402
|
|
|
403
403
|
upload_url = f"{self.datalab_api_url}/upload-file/"
|
|
404
404
|
with open(file_path, "rb") as file:
|
|
@@ -501,7 +501,7 @@ class DatalabClient(BaseDatalabClient):
|
|
|
501
501
|
RuntimeError: If the block update fails.
|
|
502
502
|
|
|
503
503
|
"""
|
|
504
|
-
payload = {
|
|
504
|
+
payload = {**block_data}
|
|
505
505
|
payload["block_id"] = block_id
|
|
506
506
|
payload["blocktype"] = block_type
|
|
507
507
|
payload["item_id"] = item_id
|
|
@@ -6,7 +6,7 @@ from getpass import getpass
|
|
|
6
6
|
from importlib.metadata import version
|
|
7
7
|
from typing import Any
|
|
8
8
|
|
|
9
|
-
import
|
|
9
|
+
import httpx2
|
|
10
10
|
from rich.logging import RichHandler
|
|
11
11
|
|
|
12
12
|
from .utils import AutoPrettyPrint
|
|
@@ -34,9 +34,9 @@ class BaseDatalabClient(metaclass=AutoPrettyPrint):
|
|
|
34
34
|
"""
|
|
35
35
|
|
|
36
36
|
_api_key: str | None = None
|
|
37
|
-
_session:
|
|
37
|
+
_session: httpx2.Client | None = None
|
|
38
38
|
_headers: dict[str, str]
|
|
39
|
-
_timeout:
|
|
39
|
+
_timeout: httpx2.Timeout = httpx2.Timeout(10.0, read=60.0)
|
|
40
40
|
|
|
41
41
|
interactive: bool = True
|
|
42
42
|
"""Whether the client is being used in an interactive context (e.g., CLI or notebook) or not.
|
|
@@ -103,7 +103,7 @@ class BaseDatalabClient(metaclass=AutoPrettyPrint):
|
|
|
103
103
|
logging.basicConfig(level=log_level, handlers=[RichHandler()])
|
|
104
104
|
self.log = logging.getLogger(__name__)
|
|
105
105
|
|
|
106
|
-
self._http_client =
|
|
106
|
+
self._http_client = httpx2.Client
|
|
107
107
|
self._headers = {"User-Agent": f"Datalab Python API/{__version__}"}
|
|
108
108
|
|
|
109
109
|
self._detect_api_url()
|
|
@@ -126,7 +126,7 @@ class BaseDatalabClient(metaclass=AutoPrettyPrint):
|
|
|
126
126
|
Do not use the session for this, so we are not passing the API key to arbitrary URLs.
|
|
127
127
|
|
|
128
128
|
"""
|
|
129
|
-
response =
|
|
129
|
+
response = httpx2.get(self.datalab_api_url)
|
|
130
130
|
match = re.search(
|
|
131
131
|
r'<meta name="x_datalab_api_url" content="(.*?)">',
|
|
132
132
|
response.text,
|
|
@@ -145,7 +145,7 @@ class BaseDatalabClient(metaclass=AutoPrettyPrint):
|
|
|
145
145
|
raise NotImplementedError
|
|
146
146
|
|
|
147
147
|
@property
|
|
148
|
-
def session(self) ->
|
|
148
|
+
def session(self) -> httpx2.Client:
|
|
149
149
|
if self._session is None:
|
|
150
150
|
return self._http_client(headers=self.headers, timeout=self.timeout)
|
|
151
151
|
return self._session
|
|
@@ -156,7 +156,7 @@ class BaseDatalabClient(metaclass=AutoPrettyPrint):
|
|
|
156
156
|
return self._headers
|
|
157
157
|
|
|
158
158
|
@property
|
|
159
|
-
def timeout(self) ->
|
|
159
|
+
def timeout(self) -> httpx2.Timeout:
|
|
160
160
|
"""A timeout object to use for the datalab API session."""
|
|
161
161
|
return self._timeout
|
|
162
162
|
|
|
@@ -246,7 +246,7 @@ class BaseDatalabClient(metaclass=AutoPrettyPrint):
|
|
|
246
246
|
self._session.close()
|
|
247
247
|
|
|
248
248
|
def _handle_response(
|
|
249
|
-
self, response:
|
|
249
|
+
self, response: httpx2.Response, url: str, expected_status: int | list[int] = 200
|
|
250
250
|
) -> dict[str, Any]:
|
|
251
251
|
"""Handle HTTP response with consistent error handling.
|
|
252
252
|
|
|
@@ -390,7 +390,7 @@ This is likely a server-side bug. Please report this issue to the datalab develo
|
|
|
390
390
|
method, url, follow_redirects=True, timeout=timeout, **kwargs
|
|
391
391
|
)
|
|
392
392
|
return self._handle_response(response, url, expected_status)
|
|
393
|
-
except (
|
|
393
|
+
except (httpx2.RequestError, httpx2.HTTPStatusError) as e:
|
|
394
394
|
raise DatalabAPIError(f"Request failed for {url}: {e}")
|
|
395
395
|
|
|
396
396
|
def _apply_elevation(self, method: str, kwargs: dict[str, Any]) -> dict[str, Any]:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: datalab-api
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: A Python API for instances of the datalab data management platform (https://github.com/datalab-org/datalab).
|
|
5
5
|
Author-email: Matthew Evans <matthew@ml-evs.science>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -17,7 +17,7 @@ Classifier: Intended Audience :: Science/Research
|
|
|
17
17
|
Classifier: Intended Audience :: Information Technology
|
|
18
18
|
Classifier: Topic :: Other/Nonlisted Topic
|
|
19
19
|
Classifier: Topic :: Scientific/Engineering
|
|
20
|
-
Requires-Python: >=3.
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
License-File: LICENSE
|
|
23
23
|
Requires-Dist: httpx2~=2.13
|
|
@@ -29,7 +29,7 @@ Provides-Extra: networkx
|
|
|
29
29
|
Requires-Dist: networkx>=3; extra == "networkx"
|
|
30
30
|
Provides-Extra: dev
|
|
31
31
|
Requires-Dist: pre-commit<5,>=3; extra == "dev"
|
|
32
|
-
Requires-Dist: pytest~=
|
|
32
|
+
Requires-Dist: pytest~=9.0; extra == "dev"
|
|
33
33
|
Requires-Dist: pytest-cov<8,>=5; extra == "dev"
|
|
34
34
|
Requires-Dist: respx~=0.22; extra == "dev"
|
|
35
35
|
Provides-Extra: docs
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|