|
18 | 18 | from ._internal.io import BioimageioYamlContent, get_reader |
19 | 19 | from ._internal.io_basics import BIOIMAGEIO_YAML |
20 | 20 | from ._internal.io_utils import write_yaml |
| 21 | +from ._internal.validation_context import get_validation_context |
21 | 22 | from ._package import get_resource_package_content |
22 | | -from .common import PermissiveFileSource |
| 23 | +from .common import HttpUrl, PermissiveFileSource |
23 | 24 |
|
24 | 25 |
|
25 | 26 | def upload( |
26 | 27 | source: Union[PermissiveFileSource, ZipFile, ResourceDescr, BioimageioYamlContent], |
27 | 28 | /, |
28 | | -) -> Union[ResourceDescr, InvalidDescr]: |
| 29 | +) -> HttpUrl: |
29 | 30 | """Upload a new resource description (version) to the hypha server to be shared at bioimage.io. |
30 | 31 | To edit an existing resource **version**, please login to https://bioimage.io and use the web interface. |
31 | 32 |
|
32 | 33 | Args: |
33 | 34 | source: The resource description to upload. |
34 | 35 |
|
35 | 36 | Returns: |
36 | | - The uploaded resource description. |
| 37 | + A URL to the uploaded resource description. |
| 38 | + Note: It might take some time until the resource is processed and available for download from the returned URL. |
37 | 39 | """ |
38 | 40 |
|
39 | 41 | if settings.hypha_upload_token is None: |
@@ -152,7 +154,10 @@ def upload( |
152 | 154 | logger.info( |
153 | 155 | "Updated status of {}/{} to 'request-review'", artifact_id, artifact_version |
154 | 156 | ) |
155 | | - |
156 | | - return load_description( |
157 | | - f"https://hypha.aicell.io/bioimage-io/artifacts/{artifact_id}/files/rdf.yaml?version={artifact_version}" |
| 157 | + logger.warning( |
| 158 | + "Upload successfull. Please note that the uploaded resource might not be available for download immediately." |
158 | 159 | ) |
| 160 | + with get_validation_context().replace(perform_io_checks=False): |
| 161 | + return HttpUrl( |
| 162 | + f"https://hypha.aicell.io/bioimage-io/artifacts/{artifact_id}/files/rdf.yaml?version={artifact_version}" |
| 163 | + ) |
0 commit comments