datashare-python 0.6.2__tar.gz → 0.6.3__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.
- {datashare_python-0.6.2 → datashare_python-0.6.3}/PKG-INFO +1 -1
- {datashare_python-0.6.2 → datashare_python-0.6.3}/datashare_python/objects.py +17 -4
- datashare_python-0.6.3/datashare_python/worker-template.tar.gz +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/pyproject.toml +1 -1
- datashare_python-0.6.2/datashare_python/worker-template.tar.gz +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/.gitignore +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/README.md +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/datashare_python/.gitignore +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/datashare_python/__init__.py +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/datashare_python/__main__.py +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/datashare_python/cli/__init__.py +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/datashare_python/cli/project.py +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/datashare_python/cli/task.py +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/datashare_python/cli/utils.py +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/datashare_python/cli/worker.py +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/datashare_python/config.py +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/datashare_python/conftest.py +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/datashare_python/constants.py +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/datashare_python/dependencies.py +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/datashare_python/discovery.py +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/datashare_python/exceptions.py +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/datashare_python/task_client.py +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/datashare_python/template.py +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/datashare_python/types_.py +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/datashare_python/utils.py +0 -0
- {datashare_python-0.6.2 → datashare_python-0.6.3}/datashare_python/worker.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: datashare-python
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.3
|
|
4
4
|
Summary: Manage Pythoœn tasks and local resources in Datashare
|
|
5
5
|
Project-URL: Homepage, https://icij.github.io/datashare-python/
|
|
6
6
|
Project-URL: Documentation, https://icij.github.io/datashare-python/
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
import os
|
|
2
3
|
from collections.abc import Awaitable, Callable
|
|
3
4
|
from dataclasses import dataclass
|
|
4
5
|
from datetime import UTC, datetime
|
|
5
6
|
from enum import StrEnum, unique
|
|
6
7
|
from io import BytesIO
|
|
7
8
|
from pathlib import Path
|
|
8
|
-
from typing import Any, Literal, Self, TypeVar, cast
|
|
9
|
+
from typing import Annotated, Any, Literal, Self, TypeVar, cast
|
|
9
10
|
|
|
10
11
|
from temporalio import workflow
|
|
11
12
|
|
|
@@ -30,8 +31,8 @@ from icij_common.pydantic_utils import (
|
|
|
30
31
|
merge_configs,
|
|
31
32
|
no_enum_values_config,
|
|
32
33
|
)
|
|
34
|
+
from pydantic import AfterValidator, Field
|
|
33
35
|
from pydantic import BaseModel as _BaseModel
|
|
34
|
-
from pydantic import Field
|
|
35
36
|
from pydantic.main import IncEx
|
|
36
37
|
|
|
37
38
|
logger = logging.getLogger(__name__)
|
|
@@ -162,9 +163,17 @@ class DocumentLocation(StrEnum):
|
|
|
162
163
|
WORKDIR = "workdir"
|
|
163
164
|
|
|
164
165
|
|
|
166
|
+
def _is_relative(value: Path) -> Path:
|
|
167
|
+
if value.is_absolute():
|
|
168
|
+
raise ValueError(
|
|
169
|
+
f"FilesystemDocument path should always be relative, found {value}"
|
|
170
|
+
)
|
|
171
|
+
return value
|
|
172
|
+
|
|
173
|
+
|
|
165
174
|
class FilesystemDocument(DatashareModel):
|
|
166
175
|
id: str
|
|
167
|
-
path: Path
|
|
176
|
+
path: Annotated[Path, AfterValidator(_is_relative)]
|
|
168
177
|
index: str
|
|
169
178
|
location: DocumentLocation
|
|
170
179
|
resource_name: str
|
|
@@ -174,11 +183,11 @@ class FilesystemDocument(DatashareModel):
|
|
|
174
183
|
) -> Path:
|
|
175
184
|
from datashare_python.utils import artifacts_dir # noqa: PLC0415
|
|
176
185
|
|
|
177
|
-
project = self.index
|
|
178
186
|
match self.location:
|
|
179
187
|
case DocumentLocation.ORIGINAL:
|
|
180
188
|
return original_root / self.path
|
|
181
189
|
case DocumentLocation.ARTIFACTS:
|
|
190
|
+
project = self.index
|
|
182
191
|
return artifacts_root / artifacts_dir(self.id, project=project) / "raw"
|
|
183
192
|
case DocumentLocation.WORKDIR:
|
|
184
193
|
return workdir / self.path
|
|
@@ -236,6 +245,10 @@ class Document(DatashareModel):
|
|
|
236
245
|
raise ValueError(msg)
|
|
237
246
|
path = artifacts_dir(doc_id=self.id, project=self.index) / "raw"
|
|
238
247
|
location = DocumentLocation.ARTIFACTS
|
|
248
|
+
# The filesystem dod is alway relative to the base location, let's make sure
|
|
249
|
+
# we store a relative path otherwise joining with the location will fail
|
|
250
|
+
if path.parts and path.parts[0] == os.path.sep:
|
|
251
|
+
path = Path(*path.parts[1:])
|
|
239
252
|
return FilesystemDocument(
|
|
240
253
|
id=self.id,
|
|
241
254
|
path=path,
|
|
Binary file
|
|
Binary file
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|