wizata-dsapi 1.3.42__tar.gz → 1.3.43__tar.gz

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.
Files changed (54) hide show
  1. {wizata_dsapi-1.3.42/wizata_dsapi.egg-info → wizata_dsapi-1.3.43}/PKG-INFO +1 -1
  2. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/mlmodel.py +1 -1
  3. wizata_dsapi-1.3.43/wizata_dsapi/version.py +1 -0
  4. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/wizata_dsapi_client.py +96 -1
  5. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43/wizata_dsapi.egg-info}/PKG-INFO +1 -1
  6. wizata_dsapi-1.3.42/wizata_dsapi/version.py +0 -1
  7. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/LICENSE.txt +0 -0
  8. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/README.rst +0 -0
  9. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/setup.cfg +0 -0
  10. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/setup.py +0 -0
  11. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/__init__.py +0 -0
  12. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/api_config.py +0 -0
  13. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/api_dto.py +0 -0
  14. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/api_interface.py +0 -0
  15. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/bucket.py +0 -0
  16. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/business_label.py +0 -0
  17. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/context.py +0 -0
  18. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/dataframe_toolkit.py +0 -0
  19. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/datapoint.py +0 -0
  20. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/datastore.py +0 -0
  21. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/ds_dataframe.py +0 -0
  22. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/dsapi_json_encoder.py +0 -0
  23. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/evaluation.py +0 -0
  24. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/execution.py +0 -0
  25. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/experiment.py +0 -0
  26. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/group_system.py +0 -0
  27. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/ilogger.py +0 -0
  28. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/insight.py +0 -0
  29. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/model_toolkit.py +0 -0
  30. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/models/__init__.py +0 -0
  31. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/models/common.py +0 -0
  32. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/paged_query_result.py +0 -0
  33. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/pipeline.py +0 -0
  34. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/pipeline_image.py +0 -0
  35. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/plot.py +0 -0
  36. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/plots/__init__.py +0 -0
  37. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/plots/common.py +0 -0
  38. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/request.py +0 -0
  39. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/script.py +0 -0
  40. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/scripts/__init__.py +0 -0
  41. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/scripts/common.py +0 -0
  42. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/solution_component.py +0 -0
  43. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/streamlit_utils.py +0 -0
  44. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/template.py +0 -0
  45. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/trigger.py +0 -0
  46. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/twin.py +0 -0
  47. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/twinregistration.py +0 -0
  48. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/wizard_function.py +0 -0
  49. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/wizard_request.py +0 -0
  50. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi/words.py +0 -0
  51. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi.egg-info/SOURCES.txt +0 -0
  52. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi.egg-info/dependency_links.txt +0 -0
  53. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi.egg-info/requires.txt +0 -0
  54. {wizata_dsapi-1.3.42 → wizata_dsapi-1.3.43}/wizata_dsapi.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wizata_dsapi
3
- Version: 1.3.42
3
+ Version: 1.3.43
4
4
  Summary: Wizata Data Science Toolkit
5
5
  Author: Wizata S.A.
6
6
  Author-email: info@wizata.com
@@ -122,7 +122,7 @@ class ModelInfo:
122
122
  """
123
123
 
124
124
  def __init__(self,
125
- key: str,
125
+ key: str = None,
126
126
  twin_hardware_id: str = None,
127
127
  property_value: str = None,
128
128
  alias: str = None,
@@ -0,0 +1 @@
1
+ __version__ = "1.3.43"
@@ -13,6 +13,7 @@ import plotly
13
13
  import msal
14
14
  import os
15
15
  import types
16
+
16
17
  import wizata_dsapi
17
18
  import urllib.parse
18
19
  import base64
@@ -26,7 +27,7 @@ from .api_dto import ApiDto, VarType, ApiDtoInterface
26
27
  from .business_label import BusinessLabel
27
28
  from .plot import Plot
28
29
  from .request import Request
29
- from .mlmodel import ModelInfo, ModelList
30
+ from .mlmodel import ModelInfo, ModelList, ModelFile
30
31
  from .experiment import Experiment
31
32
  from .script import Script
32
33
  from .execution import Execution, ExecutionStatus
@@ -1936,6 +1937,100 @@ class WizataDSAPIClient(ApiInterface, ApiDtoInterface):
1936
1937
  image = PipelineImage.loads(pipeline_image_id=pipeline_image_id, g_bytes=response_bytes)
1937
1938
  return image
1938
1939
 
1940
+ def download_model(self, identifier: str) -> ModelInfo:
1941
+ """
1942
+ download a model image directly from the repository, auto-select alias if necessary.
1943
+ :param identifier: exact identifier including alias of the model or no alias to auto-select active version.
1944
+ :return: ModelInfo with trained_model loaded, extra file must be downloaded separately.
1945
+ """
1946
+ response = requests.get(self.__url() + f"models/{identifier}/",
1947
+ headers=self.__header())
1948
+ if response.status_code == 200:
1949
+ model_info = ModelInfo()
1950
+ model_info.from_json(response.json())
1951
+ self.load_model(model_info)
1952
+ return model_info
1953
+ else:
1954
+ self.__raise_error(response)
1955
+
1956
+
1957
+ def download_file(self,
1958
+ model: ModelInfo = None,
1959
+ file: ModelFile = None,
1960
+ identifier: str = None,
1961
+ path: str = None):
1962
+ """
1963
+ download a model extra file from the repository.
1964
+ :param model: model (ModelInfo), alternatively can use identifier
1965
+ :param file: file (ModelFile), alternatively can use path
1966
+ :param identifier: identifier including alias of the model.
1967
+ :param path: path name of the file including the extension.
1968
+ :return: bytes content.
1969
+ """
1970
+
1971
+ if model is None and identifier is None:
1972
+ raise TypeError('model or identifier must be provided')
1973
+
1974
+ if file is None and path is None:
1975
+ raise TypeError('file or path must be provided')
1976
+
1977
+ if identifier is None:
1978
+ identifier = model.identifier(include_alias=True)
1979
+
1980
+ if path is None:
1981
+ path = file.path
1982
+
1983
+ response = requests.get(self.__url() + f"models/{identifier}/files/{path}/",
1984
+ headers=self.__header())
1985
+ if response.status_code == 200:
1986
+ return response.content
1987
+ else:
1988
+ self.__raise_error(response)
1989
+
1990
+
1991
+ def upload_file(self,
1992
+ content,
1993
+ model: ModelInfo = None,
1994
+ file: ModelFile = None,
1995
+ identifier: str = None,
1996
+ path: str = None
1997
+ ):
1998
+ """
1999
+ upload a model extra file to the repository.
2000
+ please use upload_model for a trained_model
2001
+ :param content: the bytes content of the file.
2002
+ :param model: model (ModelInfo), alternatively can use identifier
2003
+ :param file: file (ModelFile), alternatively can use path
2004
+ :param identifier: identifier including alias of the model.
2005
+ :param path: path name of the file including the extension.
2006
+ :return: bytes content.
2007
+ """
2008
+ if path == "trained_model.pkl" or path == "trained_model.pt" or path == "_metadata.json":
2009
+ raise RuntimeError("upload_file cannot be used to upload reserved metadata or the primary trained model")
2010
+
2011
+ if model is None and identifier is None:
2012
+ raise TypeError('model or identifier must be provided')
2013
+
2014
+ if file is None and path is None:
2015
+ raise TypeError('file or path must be provided')
2016
+
2017
+ if identifier is None:
2018
+ identifier = model.identifier(include_alias=True)
2019
+
2020
+ if path is None:
2021
+ path = file.path
2022
+
2023
+ headers = self.__header()
2024
+ headers["Content-Type"] = "application/octet-stream"
2025
+ response = requests.post(self.__url() + f"models/{identifier}/files/{path}",
2026
+ headers=headers,
2027
+ data=content,
2028
+ timeout=60)
2029
+ if response.status_code != 200 and response.status_code != 201:
2030
+ return
2031
+ else:
2032
+ self.__raise_error(response)
2033
+
1939
2034
  def load_model(self, model):
1940
2035
  """
1941
2036
  load a model pickle or torch from the repository ready to be used.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wizata_dsapi
3
- Version: 1.3.42
3
+ Version: 1.3.43
4
4
  Summary: Wizata Data Science Toolkit
5
5
  Author: Wizata S.A.
6
6
  Author-email: info@wizata.com
@@ -1 +0,0 @@
1
- __version__ = "1.3.42"
File without changes
File without changes
File without changes
File without changes