digitalhub 0.13.0b4__py3-none-any.whl → 0.13.2__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.

Potentially problematic release.


This version of digitalhub might be problematic. Click here for more details.

@@ -4,9 +4,12 @@
4
4
 
5
5
  from __future__ import annotations
6
6
 
7
+ import os
7
8
  import typing
8
9
  from pathlib import Path
9
10
 
11
+ from digitalhub.runtimes.enums import RuntimeEnvVar
12
+
10
13
  if typing.TYPE_CHECKING:
11
14
  from digitalhub.entities.project._base.entity import Project
12
15
  from digitalhub.stores.client._base.client import Client
@@ -47,6 +50,15 @@ class Context:
47
50
 
48
51
  self.is_running: bool = False
49
52
  self._run_ctx: str | None = None
53
+ self._search_run_ctx()
54
+
55
+ def _search_run_ctx(self) -> None:
56
+ """
57
+ Search for an existing run id in env.
58
+ """
59
+ run_id = os.getenv(RuntimeEnvVar.RUN_ID.value)
60
+ if run_id is not None:
61
+ self.set_run(run_id)
50
62
 
51
63
  def set_run(self, run_ctx: str) -> None:
52
64
  """
@@ -200,7 +200,7 @@ class MaterialEntity(VersionedEntity):
200
200
  list
201
201
  Paths of the files in the status.
202
202
  """
203
- return [f.get("path") for f in self.status.files]
203
+ return [f.get("path") if f.get("path") is not None else f.get("name") for f in self.status.files]
204
204
 
205
205
  ##############################
206
206
  # Private Helpers
@@ -8,7 +8,7 @@ import typing
8
8
 
9
9
  from digitalhub.entities._commons.enums import EntityTypes
10
10
  from digitalhub.entities._processors.context import context_processor
11
- from digitalhub.entities.artifact.utils import eval_source, process_kwargs
11
+ from digitalhub.entities.model.utils import eval_source, process_kwargs
12
12
  from digitalhub.utils.types import SourcesOrListOfSources
13
13
 
14
14
  if typing.TYPE_CHECKING:
@@ -143,7 +143,8 @@ class Configurator:
143
143
  raise ConfigError("Origin has already been changed.")
144
144
  if self._origin == self._env:
145
145
  self.change_to_file()
146
- self.change_to_env()
146
+ else:
147
+ self.change_to_env()
147
148
 
148
149
  def change_to_file(self) -> None:
149
150
  """
@@ -4,7 +4,7 @@
4
4
 
5
5
  from __future__ import annotations
6
6
 
7
- from datetime import datetime, timezone
7
+ from datetime import datetime, timedelta, timezone
8
8
 
9
9
  from botocore.config import Config
10
10
 
@@ -111,5 +111,5 @@ class S3StoreConfigurator(Configurator):
111
111
  return False
112
112
  dt = datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%SZ")
113
113
  dt = dt.replace(tzinfo=timezone.utc)
114
- now = datetime.now(timezone.utc) + datetime.timedelta(seconds=120)
114
+ now = datetime.now(timezone.utc) + timedelta(seconds=120)
115
115
  return dt < now
@@ -133,7 +133,9 @@ class DataframeReaderPandas(DataframeReader):
133
133
  -------
134
134
  None
135
135
  """
136
- df.to_csv(dst, index=False, **kwargs)
136
+ if "index" not in kwargs:
137
+ kwargs["index"] = False
138
+ df.to_csv(dst, **kwargs)
137
139
 
138
140
  @staticmethod
139
141
  def write_parquet(df: pd.DataFrame, dst: str | BytesIO, **kwargs) -> None:
@@ -153,7 +155,9 @@ class DataframeReaderPandas(DataframeReader):
153
155
  -------
154
156
  None
155
157
  """
156
- df.to_parquet(dst, index=False, **kwargs)
158
+ if "index" not in kwargs:
159
+ kwargs["index"] = False
160
+ df.to_parquet(dst, **kwargs)
157
161
 
158
162
  @staticmethod
159
163
  def write_table(df: pd.DataFrame, table: str, engine: Any, schema: str | None = None, **kwargs) -> None:
@@ -177,7 +181,9 @@ class DataframeReaderPandas(DataframeReader):
177
181
  -------
178
182
  None
179
183
  """
180
- df.to_sql(table, engine, schema=schema, index=False, **kwargs)
184
+ if "index" not in kwargs:
185
+ kwargs["index"] = False
186
+ df.to_sql(table, engine, schema=schema, **kwargs)
181
187
 
182
188
  ##############################
183
189
  # Utils
@@ -262,8 +262,7 @@ def carriage_return_warn(string: str) -> None:
262
262
  None
263
263
  """
264
264
  if "\r\n" in string:
265
- warn("String contains a carriage return. "
266
- "It may not be parsed correctly from remote runtimes.")
265
+ warn("String contains a carriage return. It may not be parsed correctly from remote runtimes.")
267
266
 
268
267
 
269
268
  def read_source(path: str) -> str:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: digitalhub
3
- Version: 0.13.0b4
3
+ Version: 0.13.2
4
4
  Summary: Python SDK for Digitalhub
5
5
  Project-URL: Homepage, https://github.com/scc-digitalhub/digitalhub-sdk
6
6
  Author-email: Fondazione Bruno Kessler <digitalhub@fbk.eu>, Matteo Martini <mmartini@fbk.eu>
@@ -1,7 +1,7 @@
1
1
  digitalhub/__init__.py,sha256=JrwZhABki1rBFSP3uHBJOckWQiF213_UXuJRoX7QFHA,2572
2
2
  digitalhub/context/api.py,sha256=eIVsYhneu8bEQiUV15sUNlv5WlZu6zV7Dvidvg_0FfA,1500
3
3
  digitalhub/context/builder.py,sha256=NM4xcD2n4jXwdTS2hl3MAobf-BVUQH-9LB6U3J_F3pM,2826
4
- digitalhub/context/context.py,sha256=HyyaYCmCCyr6qF7dfvorX5kNLR7NgceUGhEQGczdC8w,2246
4
+ digitalhub/context/context.py,sha256=IXgrLtI6nKp0S9XclqiyiMcsbkTVveNVkkVnURBFvFc,2569
5
5
  digitalhub/entities/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
6
6
  digitalhub/entities/builders.py,sha256=I-RVAFNgnZGmx7Dyz8_n7gfsG-BVgbgfraJal5NWipE,2054
7
7
  digitalhub/entities/_base/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
@@ -24,7 +24,7 @@ digitalhub/entities/_base/entity/_constructors/uuid.py,sha256=7QhQ9epJAnYLCKUPY6
24
24
  digitalhub/entities/_base/executable/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
25
25
  digitalhub/entities/_base/executable/entity.py,sha256=duxjwi3ROHM4hewYfUzkTpHuETfHQ8WsQ4n3wprj3DA,13321
26
26
  digitalhub/entities/_base/material/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
27
- digitalhub/entities/_base/material/entity.py,sha256=nl0uT4VvFRBmkZuyH3Jec8zdwSLOR3B9BJp8fG99zng,6759
27
+ digitalhub/entities/_base/material/entity.py,sha256=ZthX0Zctc4OZPOSHLsTygkY8lSR4uILCy_nzGtk8Kz0,6807
28
28
  digitalhub/entities/_base/material/spec.py,sha256=7lF_Pv7zGJUAR2ixmmCt-UPnoASgOLxnb9yffqwBVp8,544
29
29
  digitalhub/entities/_base/material/status.py,sha256=vAIb5qti5KxdIPdB9WYmWrCnqwGyUxuF6CpGSpcWxbE,520
30
30
  digitalhub/entities/_base/material/utils.py,sha256=diFtnOjCumenzOL1Su0ROA3KdrIJlRq5Jh845axvAtU,2512
@@ -90,7 +90,7 @@ digitalhub/entities/function/_base/entity.py,sha256=hQQMMxr5vZAf0gC5Qs8Jlqxzdp3b
90
90
  digitalhub/entities/function/_base/spec.py,sha256=qDiqfe6zSFYYH-kXPmm4R_LId985V24hO2ikFApv-6U,382
91
91
  digitalhub/entities/function/_base/status.py,sha256=wjCUr2HoQQUL4fwTjvPE8eubkCeVxbe2VV8zs0BJ5RY,278
92
92
  digitalhub/entities/model/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
93
- digitalhub/entities/model/crud.py,sha256=aL6t_EwYHNlmBQTeA4lI4Ka6JFqP5QSKZjdWmuKH404,7966
93
+ digitalhub/entities/model/crud.py,sha256=4kgsFF78pscO7Kwe-HBkP-g0oimcTcuYsWOU4qRwcuw,7963
94
94
  digitalhub/entities/model/utils.py,sha256=cswaUv320jO5rl8EXtxjwuO2nCM-QUMeJLI1aT4KBmM,2444
95
95
  digitalhub/entities/model/_base/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
96
96
  digitalhub/entities/model/_base/builder.py,sha256=6kG8-NNIup2B2GE5ABg9QwV3LoyThnw4KEYABm9kxPg,2343
@@ -209,7 +209,7 @@ digitalhub/stores/client/local/key_builder.py,sha256=ijISHvPcMyx591gHlSP1IZdiRrF
209
209
  digitalhub/stores/client/local/params_builder.py,sha256=_hR4bwn0bpGc74iKb3PM3WUJ6s3GAgsc1zcXoWjy560,3589
210
210
  digitalhub/stores/credentials/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
211
211
  digitalhub/stores/credentials/api.py,sha256=mwClY8tCG62eAhbwrmK-kzYQzEJ5ZmCW52WmYsQ-004,738
212
- digitalhub/stores/credentials/configurator.py,sha256=60vxnaGuctiv0Rjf2vxBlNzBq1iVga6sdmQ7EUt_Kdk,5487
212
+ digitalhub/stores/credentials/configurator.py,sha256=RbvkmHyf_vhLC3WamNEjC6V6NtqfSXQMuONEj4pyGwk,5505
213
213
  digitalhub/stores/credentials/enums.py,sha256=uRJ6af0ujk3Ki4DXM9rFqBROyhlbf4EYNWml_CSdJL8,1665
214
214
  digitalhub/stores/credentials/handler.py,sha256=CHrs3vmTkCQrtTenvVQ9QlRIntyrOOqZN-9BBJFG6JI,4355
215
215
  digitalhub/stores/credentials/ini_module.py,sha256=ouHCGuAA_odbpKJKuwfCQMt40jRCCh9wLID_HucKo5o,3750
@@ -225,7 +225,7 @@ digitalhub/stores/data/local/store.py,sha256=_XuIp3HpEa7hxxMfQhK05EscPA_RBiQyb61
225
225
  digitalhub/stores/data/remote/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
226
226
  digitalhub/stores/data/remote/store.py,sha256=DTrBW62zc1ix7UbLnY6YeqN0_8kGeUH_h9k7Br2HY3k,6130
227
227
  digitalhub/stores/data/s3/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
228
- digitalhub/stores/data/s3/configurator.py,sha256=7B0sLUfjiBz-u1gBxsaeU6rgB_zK1hkLf3eWTLOd9tk,3701
228
+ digitalhub/stores/data/s3/configurator.py,sha256=BDgvjlD3ES-Ri01ncq87cQtxvOa4u3_MYR81yZMZ35A,3703
229
229
  digitalhub/stores/data/s3/store.py,sha256=hwcvTkKaBWcCc7fDGuoddgT2v5b8Jr5LtTojja9tdZ8,19583
230
230
  digitalhub/stores/data/s3/utils.py,sha256=jCzXp9X2tnF3iHRSmvfnp1e5ahbZkMaMMC35FfysFZw,1894
231
231
  digitalhub/stores/data/sql/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
@@ -240,20 +240,20 @@ digitalhub/stores/readers/data/_base/builder.py,sha256=N_e5qlGrxyqnyr8F7SvbSLrgt
240
240
  digitalhub/stores/readers/data/_base/reader.py,sha256=q6s37uI_2J1cJlpvRzwr2Az8aD9lDsKvzbi82CUO3PU,1862
241
241
  digitalhub/stores/readers/data/pandas/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
242
242
  digitalhub/stores/readers/data/pandas/builder.py,sha256=ucnW7ReZgQ9XmGifYMkaDxpBVc_0XMMazOyPnUlY4os,804
243
- digitalhub/stores/readers/data/pandas/reader.py,sha256=SNZLhT4Fw7SWZoQRxacSmESBKUebPYev2cQ-VliRBRE,8089
243
+ digitalhub/stores/readers/data/pandas/reader.py,sha256=LLbp_tWSmyQizM8ULpiax3rl7bIfSs5SwVc13afNS5E,8260
244
244
  digitalhub/stores/readers/query/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
245
245
  digitalhub/utils/__init__.py,sha256=IRY2i9U97wptE3OcC_NO-EBmcAH6-Q36gMCspKetQ0k,107
246
246
  digitalhub/utils/enums.py,sha256=FvvBBkryy2-Ji0MhBMeJC6oLnd_ba0b0y1uCcWT-mvU,377
247
247
  digitalhub/utils/exceptions.py,sha256=RKLlLlMqQXWfMyT6npLjc3NPeKxzpWH-nrCv8VQC2x4,1435
248
248
  digitalhub/utils/file_utils.py,sha256=KI4ZEiNbR617d-Xjve9cHqDetLDjzOO2Tr3ht0YTZ5w,6232
249
- digitalhub/utils/generic_utils.py,sha256=eKYqG5rilY8zpHRCH4H3ph7hToJ68pAZNqifvQMr5L0,6241
249
+ digitalhub/utils/generic_utils.py,sha256=3jHGVNM8sJMyUWL-5jC6X_0mcWscoBQ5ksp0SEhn2IY,6225
250
250
  digitalhub/utils/git_utils.py,sha256=hjGNqeu7EKYTbjXKcV8YD8nbEQ99SQkilfPt-YwCPrg,4005
251
251
  digitalhub/utils/io_utils.py,sha256=p2K9VFJGzl3PmXc7GfXKZkPyg5hImduvXlfYVpnsMck,3506
252
252
  digitalhub/utils/logger.py,sha256=hH3gGE35L8jRxrg8EPXGZZAK1OA5-CvWnayuBZzteBM,545
253
253
  digitalhub/utils/types.py,sha256=orCxY43zXMJfKZsOj6FUR85u9wRBPJ0wdkzrBHTnVW8,217
254
254
  digitalhub/utils/uri_utils.py,sha256=Go787CxAOo2MMjFIEt8XssomtyV8vTdIrpyjSQK3gAM,4408
255
- digitalhub-0.13.0b4.dist-info/METADATA,sha256=rYzv9l666BndcEnYjzwJzMPZ8y3JNO9QQ4Hcixy1ypk,18028
256
- digitalhub-0.13.0b4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
257
- digitalhub-0.13.0b4.dist-info/licenses/AUTHORS,sha256=iDleK_2EAMmh0o8Te_E9mdXQCP4rBfFr9dW9d0-pCno,301
258
- digitalhub-0.13.0b4.dist-info/licenses/LICENSE,sha256=z3xQCHfGmTnigfoUe3uidW_GUSVeFBdos30w9VNTRec,11361
259
- digitalhub-0.13.0b4.dist-info/RECORD,,
255
+ digitalhub-0.13.2.dist-info/METADATA,sha256=eX13WzRWm-g-BL4xyAJjrF3a8ufDVEKBItHOHJWpEsM,18026
256
+ digitalhub-0.13.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
257
+ digitalhub-0.13.2.dist-info/licenses/AUTHORS,sha256=iDleK_2EAMmh0o8Te_E9mdXQCP4rBfFr9dW9d0-pCno,301
258
+ digitalhub-0.13.2.dist-info/licenses/LICENSE,sha256=z3xQCHfGmTnigfoUe3uidW_GUSVeFBdos30w9VNTRec,11361
259
+ digitalhub-0.13.2.dist-info/RECORD,,