pybiolib 1.2.106.dev1__py3-none-any.whl → 1.2.110.dev1__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.
@@ -78,6 +78,13 @@ def push_application(
78
78
  app_version_to_copy_images_from: Optional[str],
79
79
  is_dev_version: Optional[bool],
80
80
  ):
81
+ app_uri_parts = app_uri.split(':')
82
+ if len(app_uri_parts) > 2:
83
+ raise BioLibError('Invalid URI only a single colon allowed')
84
+
85
+ app_uri_to_fetch = app_uri_parts[0]
86
+ semantic_version = app_uri_parts[1] if len(app_uri_parts) == 2 else None
87
+
81
88
  app_path_absolute = Path(app_path).resolve()
82
89
 
83
90
  api_client = BiolibApiClient.get()
@@ -177,8 +184,6 @@ def push_application(
177
184
  source_files_zip_bytes = b''.join(byte_iterator)
178
185
  os.chdir(original_directory)
179
186
 
180
- # TODO: Raise exception if app_uri contains version
181
- app_uri_to_fetch = app_uri
182
187
  if app_version_to_copy_images_from and app_version_to_copy_images_from != 'active':
183
188
  # Get app with `app_version_to_copy_images_from` in app_uri_to_fetch to get the app version public id.
184
189
  app_uri_to_fetch += f':{app_version_to_copy_images_from}'
@@ -187,6 +192,7 @@ def push_application(
187
192
  app = app_response['app']
188
193
  # push new app version
189
194
  new_app_version_json = BiolibAppApi.push_app_version(
195
+ semantic_version=semantic_version,
190
196
  app_id=app['public_id'],
191
197
  app_name=app['name'],
192
198
  author=app['account_handle'],
@@ -1,29 +1,29 @@
1
1
  import mimetypes
2
+ import os
2
3
  import random
3
4
  import re
4
- import os
5
5
  import subprocess
6
6
 
7
7
  import biolib.api
8
8
  from biolib import biolib_errors
9
9
  from biolib._internal.http_client import HttpError
10
- from biolib.typing_utils import Optional
11
10
  from biolib.biolib_api_client import AppGetResponse
12
11
  from biolib.biolib_logging import logger
12
+ from biolib.typing_utils import Optional
13
13
 
14
14
 
15
15
  def encode_multipart(data, files):
16
16
  boundary = f'----------{random.randint(0, 1000000000)}'
17
17
  line_array = []
18
18
 
19
- for (key, value) in data.items():
20
- if not value is None:
19
+ for key, value in data.items():
20
+ if value is not None:
21
21
  line_array.append(f'--{boundary}')
22
22
  line_array.append(f'Content-Disposition: form-data; name="{key}"')
23
23
  line_array.append('')
24
24
  line_array.append(value)
25
25
 
26
- for (key, (filename, value)) in files.items():
26
+ for key, (filename, value) in files.items():
27
27
  line_array.append(f'--{boundary}')
28
28
  line_array.append(f'Content-Disposition: form-data; name="{key}"; filename="{filename}"')
29
29
  line_array.append(f'Content-Type: {mimetypes.guess_type(filename)[0] or "application/octet-stream"}')
@@ -63,7 +63,6 @@ def _get_git_repository_url() -> str:
63
63
 
64
64
 
65
65
  class BiolibAppApi:
66
-
67
66
  @staticmethod
68
67
  def get_by_uri(uri: str) -> AppGetResponse:
69
68
  # Replace protocol with @ (if supplied)
@@ -84,26 +83,31 @@ class BiolibAppApi:
84
83
 
85
84
  @staticmethod
86
85
  def push_app_version(
87
- app_id,
88
- zip_binary,
89
- author,
90
- app_name,
91
- set_as_active,
92
- app_version_id_to_copy_images_from: Optional[str],
86
+ app_id,
87
+ zip_binary,
88
+ author,
89
+ app_name,
90
+ set_as_active,
91
+ app_version_id_to_copy_images_from: Optional[str],
92
+ semantic_version: Optional[str],
93
93
  ):
94
94
  try:
95
+ data = {
96
+ 'app': app_id,
97
+ 'set_as_active': 'true' if set_as_active else 'false',
98
+ 'state': 'published',
99
+ 'app_version_id_to_copy_images_from': app_version_id_to_copy_images_from,
100
+ 'git_branch_name': _get_git_branch_name(),
101
+ 'git_repository_url': _get_git_repository_url(),
102
+ }
103
+ if semantic_version:
104
+ data['semantic_version'] = semantic_version
105
+
95
106
  content_type, data_encoded = encode_multipart(
96
- data={
97
- 'app': app_id,
98
- 'set_as_active': 'true' if set_as_active else 'false',
99
- 'state': 'published',
100
- 'app_version_id_to_copy_images_from': app_version_id_to_copy_images_from,
101
- 'git_branch_name': _get_git_branch_name(),
102
- 'git_repository_url': _get_git_repository_url(),
103
- },
107
+ data=data,
104
108
  files={
105
109
  'source_files_zip': ('source_files.zip', zip_binary),
106
- }
110
+ },
107
111
  )
108
112
  response = biolib.api.client.post(
109
113
  path='/app_versions/',
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pybiolib
3
- Version: 1.2.106.dev1
3
+ Version: 1.2.110.dev1
4
4
  Summary: BioLib Python Client
5
5
  Home-page: https://github.com/biolib
6
6
  License: MIT
@@ -15,7 +15,7 @@ biolib/_internal/lfs/__init__.py,sha256=gSWo_xg61UniYgD7yNYxeT4I9uaXBCBSi3_nmZjn
15
15
  biolib/_internal/lfs/cache.py,sha256=pQS2np21rdJ6I3DpoOutnzPHpLOZgUIS8TMltUJk_k4,2226
16
16
  biolib/_internal/libs/__init__.py,sha256=Jdf4tNPqe_oIIf6zYml6TiqhL_02Vyqwge6IELrAFhw,98
17
17
  biolib/_internal/libs/fusepy/__init__.py,sha256=AWDzNFS-XV_5yKb0Qx7kggIhPzq1nj_BZS5y2Nso08k,41944
18
- biolib/_internal/push_application.py,sha256=mKs3kIKW-ZYfz3Cy6LIyFBwsWkbcGZ9zgMk-xn5NDyg,11660
18
+ biolib/_internal/push_application.py,sha256=OtfH4xsyOZE_bjVZAVWe7LSNo4t2OUKY_6dfzWDfNts,11874
19
19
  biolib/_internal/runtime.py,sha256=BiHl4klUHr36MCpqKaUso4idHeBZfPAahLYRQrabFqA,486
20
20
  biolib/_internal/types/__init__.py,sha256=xLgOQJFh3GRtiqIJq7MaqHReZx4pp34_zcaFQ_JjuJ4,198
21
21
  biolib/_internal/types/app.py,sha256=Mz2QGD_jESX-K9JYnLWPo4YA__Q_1FQQTk9pvidCohU,118
@@ -36,7 +36,7 @@ biolib/biolib_api_client/__init__.py,sha256=E5EMa19wJoblwSdQPYrxc_BtIeRsAuO0L_jQ
36
36
  biolib/biolib_api_client/api_client.py,sha256=ciNx4ybpyKG5LEf4KQdGEz13r0jTxImyQat4_HDecD0,7373
37
37
  biolib/biolib_api_client/app_types.py,sha256=1sXz9XnLRKNALMglNdTbew7AL6OkcUan0MPdj4xQLis,2456
38
38
  biolib/biolib_api_client/auth.py,sha256=kjm0ZHnH3I8so3su2sZbBxNHYp-ZUdrZ5lwQ0K36RSw,949
39
- biolib/biolib_api_client/biolib_app_api.py,sha256=DndlVxrNTes6DOaWyMINLGZQCRMWVvR7gwt5HVlyf5Y,4240
39
+ biolib/biolib_api_client/biolib_app_api.py,sha256=i5KPZNpopU7cqcjVfICml-31ca-1-CU_rdZgKiZt0Vs,4343
40
40
  biolib/biolib_api_client/biolib_job_api.py,sha256=7bKfav3-12ewXkEUoLdCmbWdebW8148kxfGJW9SsXZI,7125
41
41
  biolib/biolib_api_client/common_types.py,sha256=RH-1KNHqUF-EkTpfPOSTt5Mq1GPdfju_cqXDesscO1I,123
42
42
  biolib/biolib_api_client/job_types.py,sha256=Dl4NhU2xpgpXV-7YIoDf6WL63SLR5bni55OX8x5539M,1300
@@ -119,8 +119,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
119
119
  biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
120
120
  biolib/utils/seq_util.py,sha256=WJnU9vZdwY8RHXvzATyV80OXzyJ7w9EkG33Tna9Nr6A,5698
121
121
  biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
122
- pybiolib-1.2.106.dev1.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
123
- pybiolib-1.2.106.dev1.dist-info/METADATA,sha256=nfPXBgHW1zZD412eFZ2Z-XG2qpNAsDOVrfbc43mksGU,1512
124
- pybiolib-1.2.106.dev1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
125
- pybiolib-1.2.106.dev1.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
126
- pybiolib-1.2.106.dev1.dist-info/RECORD,,
122
+ pybiolib-1.2.110.dev1.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
123
+ pybiolib-1.2.110.dev1.dist-info/METADATA,sha256=4or05bYpJ5Fyqp3qmEoiLnuwbTKVraKCi4bgjFFT_nY,1512
124
+ pybiolib-1.2.110.dev1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
125
+ pybiolib-1.2.110.dev1.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
126
+ pybiolib-1.2.110.dev1.dist-info/RECORD,,