pybiolib 1.1.2023__py3-none-any.whl → 1.1.2031__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.
- biolib/_internal/data_record/data_record.py +9 -6
- biolib/api/__init__.py +1 -0
- biolib/api/client.py +30 -15
- {pybiolib-1.1.2023.dist-info → pybiolib-1.1.2031.dist-info}/METADATA +1 -1
- {pybiolib-1.1.2023.dist-info → pybiolib-1.1.2031.dist-info}/RECORD +8 -8
- {pybiolib-1.1.2023.dist-info → pybiolib-1.1.2031.dist-info}/LICENSE +0 -0
- {pybiolib-1.1.2023.dist-info → pybiolib-1.1.2031.dist-info}/WHEEL +0 -0
- {pybiolib-1.1.2023.dist-info → pybiolib-1.1.2031.dist-info}/entry_points.txt +0 -0
@@ -22,11 +22,6 @@ PathFilter = Union[str, Callable[[str], bool]]
|
|
22
22
|
class DataRecord:
|
23
23
|
def __init__(self, uri: str):
|
24
24
|
self._uri = uri
|
25
|
-
uri_parsed = parse_app_uri(uri, use_account_as_name_default=False)
|
26
|
-
if not uri_parsed['app_name']:
|
27
|
-
raise ValueError('Expected parameter "uri" to contain resource name')
|
28
|
-
|
29
|
-
self._name = uri_parsed['app_name']
|
30
25
|
|
31
26
|
def __repr__(self):
|
32
27
|
return f'DataRecord: {self._uri}'
|
@@ -37,7 +32,11 @@ class DataRecord:
|
|
37
32
|
|
38
33
|
@property
|
39
34
|
def name(self) -> str:
|
40
|
-
|
35
|
+
uri_parsed = parse_app_uri(self.uri, use_account_as_name_default=False)
|
36
|
+
if not uri_parsed['app_name']:
|
37
|
+
raise ValueError('Expected parameter "uri" to contain resource name')
|
38
|
+
|
39
|
+
return uri_parsed['app_name']
|
41
40
|
|
42
41
|
def list_files(self, path_filter: Optional[PathFilter] = None) -> List[LazyLoadedFile]:
|
43
42
|
app_response: AppGetResponse = api_client.get(path='/app/', params={'uri': self._uri}).json()
|
@@ -76,6 +75,10 @@ class DataRecord:
|
|
76
75
|
def save_files(self, output_dir: str, path_filter: Optional[PathFilter] = None) -> None:
|
77
76
|
self.download_files(output_dir=output_dir, path_filter=path_filter)
|
78
77
|
|
78
|
+
def update(self, data_path: str) -> None:
|
79
|
+
assert os.path.isdir(data_path), f'The path "{data_path}" is not a directory.'
|
80
|
+
self._uri = lfs.push_large_file_system(lfs_uri=self._uri, input_dir=data_path)
|
81
|
+
|
79
82
|
@staticmethod
|
80
83
|
def create(destination: str, data_path: str, name: Optional[str] = None) -> 'DataRecord':
|
81
84
|
assert os.path.isdir(data_path), f'The path "{data_path}" is not a directory.'
|
biolib/api/__init__.py
CHANGED
biolib/api/client.py
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
from urllib.parse import
|
1
|
+
from urllib.parse import urlencode, urljoin
|
2
2
|
|
3
|
-
|
3
|
+
import importlib_metadata
|
4
|
+
|
5
|
+
from biolib._internal.http_client import HttpClient, HttpResponse
|
4
6
|
from biolib.biolib_api_client import BiolibApiClient as DeprecatedApiClient
|
5
|
-
from biolib.
|
7
|
+
from biolib.typing_utils import Dict, Optional, Union, cast
|
6
8
|
|
7
9
|
OptionalHeaders = Union[
|
8
10
|
Optional[Dict[str, str]],
|
@@ -10,14 +12,24 @@ OptionalHeaders = Union[
|
|
10
12
|
]
|
11
13
|
|
12
14
|
|
15
|
+
def _get_biolib_package_version() -> str:
|
16
|
+
# try fetching version, if it fails (usually when in dev), add default
|
17
|
+
try:
|
18
|
+
return cast(str, importlib_metadata.version('pybiolib'))
|
19
|
+
except importlib_metadata.PackageNotFoundError:
|
20
|
+
return '0.0.0'
|
21
|
+
|
22
|
+
|
13
23
|
class ApiClient(HttpClient):
|
24
|
+
_biolib_package_version: str = _get_biolib_package_version()
|
25
|
+
|
14
26
|
def get(
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
27
|
+
self,
|
28
|
+
path: str,
|
29
|
+
params: Optional[Dict[str, Union[str, int]]] = None,
|
30
|
+
headers: OptionalHeaders = None,
|
31
|
+
authenticate: bool = True,
|
32
|
+
retries: int = 10,
|
21
33
|
) -> HttpResponse:
|
22
34
|
return self.request(
|
23
35
|
headers=self._get_headers(opt_headers=headers, authenticate=authenticate),
|
@@ -27,12 +39,12 @@ class ApiClient(HttpClient):
|
|
27
39
|
)
|
28
40
|
|
29
41
|
def post(
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
42
|
+
self,
|
43
|
+
path: str,
|
44
|
+
data: Optional[Union[Dict, bytes]] = None,
|
45
|
+
headers: OptionalHeaders = None,
|
46
|
+
authenticate: bool = True,
|
47
|
+
retries: int = 5,
|
36
48
|
) -> HttpResponse:
|
37
49
|
return self.request(
|
38
50
|
data=data,
|
@@ -74,6 +86,9 @@ class ApiClient(HttpClient):
|
|
74
86
|
if access_token and authenticate:
|
75
87
|
headers['Authorization'] = f'Bearer {access_token}'
|
76
88
|
|
89
|
+
headers['client-type'] = 'biolib-python'
|
90
|
+
headers['client-version'] = ApiClient._biolib_package_version
|
91
|
+
|
77
92
|
return headers
|
78
93
|
|
79
94
|
@staticmethod
|
@@ -3,7 +3,7 @@ README.md,sha256=_IH7pxFiqy2bIAmaVeA-iVTyUwWRjMIlfgtUbYTtmls,368
|
|
3
3
|
biolib/__init__.py,sha256=nfZvVkrHZLvjvvlAvFzhvem9NMfqgmw8NWaCH9HGzew,4045
|
4
4
|
biolib/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
biolib/_internal/data_record/__init__.py,sha256=1Bk303i3rFet9veS56fIsrBYtT5X3n9vcsYMA6T6c5o,36
|
6
|
-
biolib/_internal/data_record/data_record.py,sha256=
|
6
|
+
biolib/_internal/data_record/data_record.py,sha256=NLzeyzqtzB9QOVUDcEiOn2WbMdMijbjZGYgy_p592_c,7372
|
7
7
|
biolib/_internal/data_record/remote_storage_endpoint.py,sha256=hILu0TmFx-ZyDYbWPC4QEPogP0RRVEqwgJc8OEHYp50,1742
|
8
8
|
biolib/_internal/fuse_mount/__init__.py,sha256=B_tM6RM2dBw-vbpoHJC4X3tOAaN1H2RDvqYJOw3xFwg,55
|
9
9
|
biolib/_internal/fuse_mount/experiment_fuse_mount.py,sha256=08aUdEq_bvqLBft_gSLjOClKDy5sBnMts1RfJf7AP_U,7012
|
@@ -13,8 +13,8 @@ biolib/_internal/libs/fusepy/__init__.py,sha256=AWDzNFS-XV_5yKb0Qx7kggIhPzq1nj_B
|
|
13
13
|
biolib/_internal/push_application.py,sha256=H1PGNtVJ0vRC0li39gFMpPpjm6QeZ8Ob-7cLkLmxS_Y,10009
|
14
14
|
biolib/_internal/runtime.py,sha256=BnFvRWYnxPXCgOtfxupN255Zxx9Gw6oPZyzUIGODw3k,3060
|
15
15
|
biolib/_internal/utils/__init__.py,sha256=p5vsIFyu-zYqBgdSMfwW9NC_jk7rXvvCbV4Bzd3As7c,630
|
16
|
-
biolib/api/__init__.py,sha256=
|
17
|
-
biolib/api/client.py,sha256
|
16
|
+
biolib/api/__init__.py,sha256=mQ4u8FijqyLzjYMezMUUbbBGNB3iFmkNdjXnWPZ7Jlw,138
|
17
|
+
biolib/api/client.py,sha256=9MD1qI52BnRC_QSydFGjyFquwFw0R9dkDfUrjUouuHQ,3490
|
18
18
|
biolib/app/__init__.py,sha256=cdPtcfb_U-bxb9iSL4fCEq2rpD9OjkyY4W-Zw60B0LI,37
|
19
19
|
biolib/app/app.py,sha256=8AvPYL1W2wxQ7t7BB2KeVU2WPrm3UL6vVuHPGs8g9L0,8388
|
20
20
|
biolib/app/search_apps.py,sha256=K4a41f5XIWth2BWI7OffASgIsD0ko8elCax8YL2igaY,1470
|
@@ -109,8 +109,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
|
|
109
109
|
biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
|
110
110
|
biolib/utils/seq_util.py,sha256=jC5WhH63FTD7SLFJbxQGA2hOt9NTwq9zHl_BEec1Z0c,4907
|
111
111
|
biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
|
112
|
-
pybiolib-1.1.
|
113
|
-
pybiolib-1.1.
|
114
|
-
pybiolib-1.1.
|
115
|
-
pybiolib-1.1.
|
116
|
-
pybiolib-1.1.
|
112
|
+
pybiolib-1.1.2031.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
113
|
+
pybiolib-1.1.2031.dist-info/METADATA,sha256=nCqh-1SL4_FpMx4NUpk8FnW8lYn-wpUVIFEnScJ4BpI,1508
|
114
|
+
pybiolib-1.1.2031.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
115
|
+
pybiolib-1.1.2031.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
|
116
|
+
pybiolib-1.1.2031.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|