pybiolib 1.2.252__py3-none-any.whl → 1.2.257__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/push_application.py +5 -7
- biolib/api/client.py +13 -10
- biolib/biolib_api_client/api_client.py +7 -4
- {pybiolib-1.2.252.dist-info → pybiolib-1.2.257.dist-info}/METADATA +1 -1
- {pybiolib-1.2.252.dist-info → pybiolib-1.2.257.dist-info}/RECORD +8 -8
- {pybiolib-1.2.252.dist-info → pybiolib-1.2.257.dist-info}/LICENSE +0 -0
- {pybiolib-1.2.252.dist-info → pybiolib-1.2.257.dist-info}/WHEEL +0 -0
- {pybiolib-1.2.252.dist-info → pybiolib-1.2.257.dist-info}/entry_points.txt +0 -0
@@ -219,12 +219,6 @@ def push_application(
|
|
219
219
|
docker_tags = new_app_version_json.get('docker_tags', {})
|
220
220
|
if not app_version_to_copy_images_from and docker_tags:
|
221
221
|
logger.info('Found docker images to push.')
|
222
|
-
|
223
|
-
# Auth to be sent to proxy
|
224
|
-
# The tokens are sent as "{access_token},{job_id}". We leave job_id blank on push.
|
225
|
-
tokens = f'{BiolibApiClient.get().access_token},'
|
226
|
-
auth_config = {'username': 'biolib', 'password': tokens}
|
227
|
-
|
228
222
|
docker_client = BiolibDockerClient.get_docker_client()
|
229
223
|
|
230
224
|
for module_name, repo_and_tag in docker_tags.items():
|
@@ -264,7 +258,11 @@ def push_application(
|
|
264
258
|
tag=tag,
|
265
259
|
stream=True,
|
266
260
|
decode=True,
|
267
|
-
auth_config=
|
261
|
+
auth_config={
|
262
|
+
'username': 'biolib',
|
263
|
+
# For legacy reasons access token is sent with trailing comma ','
|
264
|
+
'password': api_client.resource_deploy_key or f'{api_client.access_token},',
|
265
|
+
},
|
268
266
|
)
|
269
267
|
|
270
268
|
process_docker_status_updates(push_status_updates, action='Pushing')
|
biolib/api/client.py
CHANGED
@@ -75,16 +75,19 @@ class ApiClient(HttpClient):
|
|
75
75
|
# Only keep header keys with a value
|
76
76
|
headers: Dict[str, str] = {key: value for key, value in (opt_headers or {}).items() if value}
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
78
|
+
if authenticate:
|
79
|
+
deprecated_api_client = DeprecatedApiClient.get()
|
80
|
+
if deprecated_api_client.is_signed_in:
|
81
|
+
deprecated_api_client.refresh_access_token()
|
82
|
+
|
83
|
+
if deprecated_api_client.resource_deploy_key:
|
84
|
+
headers['Authorization'] = f'Token {deprecated_api_client.resource_deploy_key}'
|
85
|
+
else:
|
86
|
+
# Adding access_token outside is_signed_in check as job_worker.py currently sets access_token
|
87
|
+
# without setting refresh_token
|
88
|
+
access_token = deprecated_api_client.access_token
|
89
|
+
if access_token:
|
90
|
+
headers['Authorization'] = f'Bearer {access_token}'
|
88
91
|
|
89
92
|
headers['client-type'] = 'biolib-python'
|
90
93
|
headers['client-version'] = ApiClient._biolib_package_version
|
@@ -30,13 +30,14 @@ class _ApiClient:
|
|
30
30
|
self.base_url: str = base_url
|
31
31
|
self.access_token: Optional[str] = access_token # TODO: Deprecate passing access_token in constructor
|
32
32
|
self.refresh_token: Optional[str] = None
|
33
|
+
self.resource_deploy_key: Optional[str] = None
|
33
34
|
|
34
35
|
self._user_state = UserState()
|
35
36
|
self._sign_in_attempted: bool = False
|
36
37
|
|
37
38
|
@property
|
38
39
|
def is_signed_in(self) -> bool:
|
39
|
-
return bool(self.refresh_token)
|
40
|
+
return bool(self.refresh_token or self.resource_deploy_key)
|
40
41
|
|
41
42
|
def set_user_tokens(self, user_tokens: UserTokens) -> None:
|
42
43
|
with self._user_state as user_state:
|
@@ -57,8 +58,7 @@ class _ApiClient:
|
|
57
58
|
user_state['refresh_token'] = None
|
58
59
|
|
59
60
|
def refresh_access_token(self) -> None:
|
60
|
-
if not self.is_signed_in:
|
61
|
-
# Can't refresh access token if not signed in
|
61
|
+
if not self.is_signed_in or self.resource_deploy_key:
|
62
62
|
return
|
63
63
|
|
64
64
|
if self.access_token:
|
@@ -95,7 +95,10 @@ class _ApiClient:
|
|
95
95
|
api_token = os.getenv('BIOLIB_TOKEN', default=None)
|
96
96
|
|
97
97
|
if api_token:
|
98
|
-
|
98
|
+
if api_token.startswith('bld_'):
|
99
|
+
self.resource_deploy_key = api_token
|
100
|
+
else:
|
101
|
+
self.sign_in_with_api_token(api_token)
|
99
102
|
else:
|
100
103
|
with self._user_state as user_state:
|
101
104
|
refresh_token_from_state = user_state['refresh_token']
|
@@ -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=
|
18
|
+
biolib/_internal/push_application.py,sha256=LQSawvF8uWOGOu-6sEJulvc6ia4Fo3pfQ2m_jLBqXRs,11946
|
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
|
@@ -29,12 +29,12 @@ biolib/_internal/utils/__init__.py,sha256=p5vsIFyu-zYqBgdSMfwW9NC_jk7rXvvCbV4Bzd
|
|
29
29
|
biolib/_internal/utils/multinode.py,sha256=zWrQhcVK5u_xdWX2oIM-D_2fINqNPlqF_h71fu4K8LY,8279
|
30
30
|
biolib/_runtime/runtime.py,sha256=bZQ0m39R9jOBVAtlyvzDnOobKueOAQUCwMUZjDQnO7E,4439
|
31
31
|
biolib/api/__init__.py,sha256=mQ4u8FijqyLzjYMezMUUbbBGNB3iFmkNdjXnWPZ7Jlw,138
|
32
|
-
biolib/api/client.py,sha256=
|
32
|
+
biolib/api/client.py,sha256=_kmwaGI_-u7kOeWVCYmo-pD2K1imwEv9n2gNZRb5F-I,3790
|
33
33
|
biolib/app/__init__.py,sha256=cdPtcfb_U-bxb9iSL4fCEq2rpD9OjkyY4W-Zw60B0LI,37
|
34
34
|
biolib/app/app.py,sha256=mJafDLtnoX66egHF94NrUhmhzjpFzvRj2STh0RVGJCY,8862
|
35
35
|
biolib/app/search_apps.py,sha256=K4a41f5XIWth2BWI7OffASgIsD0ko8elCax8YL2igaY,1470
|
36
36
|
biolib/biolib_api_client/__init__.py,sha256=E5EMa19wJoblwSdQPYrxc_BtIeRsAuO0L_jQweWw-Yk,182
|
37
|
-
biolib/biolib_api_client/api_client.py,sha256=
|
37
|
+
biolib/biolib_api_client/api_client.py,sha256=ohvbWbpresxLHFGPkvXACfmiTYsBk8RBx5XsBbLYg_M,7546
|
38
38
|
biolib/biolib_api_client/app_types.py,sha256=1sXz9XnLRKNALMglNdTbew7AL6OkcUan0MPdj4xQLis,2456
|
39
39
|
biolib/biolib_api_client/auth.py,sha256=kjm0ZHnH3I8so3su2sZbBxNHYp-ZUdrZ5lwQ0K36RSw,949
|
40
40
|
biolib/biolib_api_client/biolib_app_api.py,sha256=RUXrTxk7XKzm4wxv7NBXttuFjT60DI9vNOvkS-cjKNc,5065
|
@@ -120,8 +120,8 @@ biolib/utils/cache_state.py,sha256=u256F37QSRIVwqKlbnCyzAX4EMI-kl6Dwu6qwj-Qmag,3
|
|
120
120
|
biolib/utils/multipart_uploader.py,sha256=XvGP1I8tQuKhAH-QugPRoEsCi9qvbRk-DVBs5PNwwJo,8452
|
121
121
|
biolib/utils/seq_util.py,sha256=Ozk0blGtPur_D9MwShD02r_mphyQmgZkx-lOHOwnlIM,6730
|
122
122
|
biolib/utils/zip/remote_zip.py,sha256=0wErYlxir5921agfFeV1xVjf29l9VNgGQvNlWOlj2Yc,23232
|
123
|
-
pybiolib-1.2.
|
124
|
-
pybiolib-1.2.
|
125
|
-
pybiolib-1.2.
|
126
|
-
pybiolib-1.2.
|
127
|
-
pybiolib-1.2.
|
123
|
+
pybiolib-1.2.257.dist-info/LICENSE,sha256=F2h7gf8i0agDIeWoBPXDMYScvQOz02pAWkKhTGOHaaw,1067
|
124
|
+
pybiolib-1.2.257.dist-info/METADATA,sha256=nxPz1_DHtgQxfOuCZbBy5GzPPJrqjCyZNPwBOzlTods,1558
|
125
|
+
pybiolib-1.2.257.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
126
|
+
pybiolib-1.2.257.dist-info/entry_points.txt,sha256=p6DyaP_2kctxegTX23WBznnrDi4mz6gx04O5uKtRDXg,42
|
127
|
+
pybiolib-1.2.257.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|