python-sdk-remote 0.0.129__tar.gz → 0.0.130__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.

Potentially problematic release.


This version of python-sdk-remote might be problematic. Click here for more details.

Files changed (21) hide show
  1. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/PKG-INFO +1 -1
  2. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/python_sdk_remote/src/http_response.py +7 -7
  3. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/python_sdk_remote/src/item.py +4 -3
  4. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/python_sdk_remote/src/mini_logger.py +5 -2
  5. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/python_sdk_remote/src/our_object.py +3 -3
  6. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/python_sdk_remote/src/temp.py +7 -4
  7. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/python_sdk_remote/src/unified_json.py +5 -3
  8. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/python_sdk_remote/src/utilities.py +25 -29
  9. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/python_sdk_remote.egg-info/PKG-INFO +1 -1
  10. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/setup.py +1 -1
  11. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/README.md +0 -0
  12. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/pyproject.toml +0 -0
  13. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/python_sdk_remote/src/__init__.py +0 -0
  14. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/python_sdk_remote/src/constants.py +0 -0
  15. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/python_sdk_remote/src/valid_json_versions.py +0 -0
  16. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/python_sdk_remote/src/validate_environment.py +0 -0
  17. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/python_sdk_remote.egg-info/SOURCES.txt +0 -0
  18. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/python_sdk_remote.egg-info/dependency_links.txt +0 -0
  19. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/python_sdk_remote.egg-info/requires.txt +0 -0
  20. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/python_sdk_remote.egg-info/top_level.txt +0 -0
  21. {python_sdk_remote-0.0.129 → python_sdk_remote-0.0.130}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-sdk-remote
3
- Version: 0.0.129
3
+ Version: 0.0.130
4
4
  Summary: PyPI Package for Circles Python SDK Local Python
5
5
  Home-page: https://github.com/circles-zone/python-sdk-remote-python-package
6
6
  Author: Circles
@@ -1,25 +1,25 @@
1
1
  import traceback
2
+ from datetime import date
2
3
  from functools import wraps
3
4
  from http import HTTPStatus
4
5
  from typing import Any
5
6
 
6
7
  from .mini_logger import MiniLogger as logger
7
- from datetime import date
8
- from . import temp
8
+ from .temp import deprecation_warning
9
9
  from .utilities import camel_to_snake, snake_to_camel, to_dict, to_json
10
10
 
11
11
  HEADERS_KEY = 'headers'
12
12
  AUTHORIZATION_KEY = 'authorization'
13
13
  AUTHORIZATION_PREFIX = 'Bearer '
14
14
 
15
- temp.deprecation_warning("http_response","DELETE",date(2024,7,25))
15
+ # TODO: move date(2024, 6, 5) to constants and use it everywhere
16
+ deprecation_warning("http_response", "DELETE", date(2024, 6, 5))
17
+
16
18
 
17
19
  # TODO Align those methods with typescript-sdk https://github.com/circles-zone/typescript-sdk-remote-typescript-package/blob/dev/typescript-sdk/src/utils/index.ts
18
20
  # TODO Shall we create also createInternalServerErrorHttpResponse(), createOkHttpResponse() like we have in TypeScript?
19
21
 
20
- # TODO: add handler wrapper?
21
-
22
- #TODO Shall we add the word body? i.e. get_body_payload_idct_from_event()
22
+ # TODO Shall we add the word body? i.e. get_body_payload_dict_from_event()
23
23
  def get_payload_dict_from_event(event: dict) -> dict:
24
24
  """Extracts params sent with payload"""
25
25
  return to_dict(event.get('body'))
@@ -81,7 +81,7 @@ def handler_decorator(logger):
81
81
  # TODO: should we auto detect user_jwt if not provided?
82
82
  def create_authorization_http_headers(user_jwt: str) -> dict:
83
83
  logger.start(object={"user_jwt": user_jwt})
84
- #TODO check the validity of user_jwt and it is not None and raise exception, please do the same in all other functions.
84
+ # TODO check the validity of user_jwt and it is not None and raise exception, please do the same in all other functions.
85
85
  authorization_http_headers = {
86
86
  'Content-Type': 'application/json',
87
87
  'Authorization': AUTHORIZATION_PREFIX + user_jwt,
@@ -1,12 +1,13 @@
1
1
  from abc import abstractmethod
2
+ from datetime import date
2
3
 
3
4
  from .our_object import OurObject
4
- from datetime import date
5
- from . import temp
5
+ from .temp import deprecation_warning
6
+
6
7
 
7
8
  class Item(OurObject):
8
9
  def __init__(self, **kwargs):
9
- temp.deprecation_warning("item","DELETE",date(2024,7,25))
10
+ deprecation_warning("item", "DELETE", date(2024, 6, 5))
10
11
  super().__init__(**kwargs)
11
12
 
12
13
  @abstractmethod
@@ -2,7 +2,10 @@ import logging
2
2
  import os
3
3
  import sys
4
4
 
5
- LOGGER_MINIMUM_SEVERITY = os.getenv("LOGGER_MINIMUM_SEVERITY", "INFO").upper()
5
+ # Try to get MINI_LOGGER_MINIMUM_SEVERITY from the environment, if not found, try to get LOGGER_MINIMUM_SEVERITY
6
+ # If not found, default to INFO
7
+ LOGGER_MINIMUM_SEVERITY = os.getenv("MINI_LOGGER_MINIMUM_SEVERITY",
8
+ os.getenv("LOGGER_MINIMUM_SEVERITY", "INFO")).upper()
6
9
  # logging expects NOTSET/DEBUG/INFO/WARNING/ERROR/FATAL/CRITICAL
7
10
  if LOGGER_MINIMUM_SEVERITY.isdigit():
8
11
  logger_minimum_severity = int(LOGGER_MINIMUM_SEVERITY)
@@ -25,7 +28,7 @@ logger = logging.getLogger(__name__)
25
28
 
26
29
  class MiniLogger:
27
30
  # TODO Can we so one generic function call by all
28
-
31
+ # TODO: print the caller function name
29
32
  @staticmethod
30
33
  def start(message: str = "", object: dict = None):
31
34
  """
@@ -1,15 +1,15 @@
1
1
  import json
2
2
  from abc import ABC, abstractmethod
3
+ from datetime import date
3
4
 
4
5
  from .mini_logger import MiniLogger as logger
5
- from datetime import date
6
- from . import temp
6
+ from .temp import deprecation_warning
7
7
 
8
8
 
9
9
  # TODO Where are we using it? Shall we extend the usage of OurObject as the father of all our entities?
10
10
  class OurObject(ABC):
11
11
  def __init__(self, **kwargs):
12
- temp.deprecation_warning("our_object","DELETE",date(2024,7,25))
12
+ deprecation_warning("our_object", "DELETE", date(2024, 6, 5))
13
13
  INIT_METHOD_NAME = '__init__'
14
14
  logger.start(INIT_METHOD_NAME, object={'kwargs': kwargs})
15
15
  self.kwargs = kwargs
@@ -1,15 +1,18 @@
1
- from functools import lru_cache
2
- from datetime import date
1
+ # TODO: remove once all breaking changes related to deprecation are done
3
2
  import inspect
3
+ from datetime import date
4
+ from functools import lru_cache
5
+
4
6
  from .mini_logger import MiniLogger as logger
5
7
 
8
+
6
9
  @lru_cache(maxsize=64) # don't print the same warning multiple times
7
10
  def deprecation_warning(old_name: str, new_name: str, start_date: date = None) -> None:
8
11
  if start_date and start_date < date.today():
9
12
  return
10
- warnings_message = f"Please use {old_name} instead of {new_name}."
13
+ warnings_message = f"{new_name} {old_name} and use the local version."
11
14
  try:
12
15
  warnings_message += " Called from: " + inspect.stack()[2].filename
13
16
  except Exception:
14
17
  pass
15
- logger.warning(warnings_message)
18
+ logger.warning(warnings_message)
@@ -1,11 +1,13 @@
1
- from .valid_json_versions import valid_json_versions
2
1
  from datetime import date
3
- from . import temp
2
+
3
+ from .temp import deprecation_warning
4
+ from .valid_json_versions import valid_json_versions
5
+
4
6
 
5
7
  # TODO Shall we merge it with the machine-learning-unified-json?
6
8
  class UnifiedJson:
7
9
  def __init__(self, data: dict, json_version: str):
8
- temp.deprecation_warning("unified_json","DELETE",date(2024,7,25))
10
+ deprecation_warning("unified_json", "DELETE", date(2024, 6, 5))
9
11
  if json_version not in valid_json_versions:
10
12
  raise Exception(
11
13
  f"version {json_version} is not in valid_json_versions {valid_json_versions}, "
@@ -1,12 +1,9 @@
1
- import inspect
2
1
  import json
3
2
  import os
4
3
  import random
5
4
  import re
6
5
  from datetime import date, datetime, time, timedelta, timezone
7
- from functools import lru_cache
8
6
  from urllib.parse import urlparse
9
- from . import temp
10
7
 
11
8
  import jwt
12
9
  import requests
@@ -14,6 +11,7 @@ from dotenv import load_dotenv
14
11
  from url_remote.environment_name_enum import EnvironmentName
15
12
 
16
13
  from .mini_logger import MiniLogger as logger
14
+ from .temp import deprecation_warning
17
15
 
18
16
  load_dotenv()
19
17
  # TODO Let's do brainstorming on this
@@ -34,22 +32,22 @@ DEFAULT_DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
34
32
 
35
33
 
36
34
  def append_if_not_exist(lst: list, item: object) -> None:
37
- temp.deprecation_warning("append_if_not_exist","DELETE",date(2024,7,25))
35
+ deprecation_warning("append_if_not_exist", "DELETE", date(2024, 6, 5))
38
36
  if item not in lst:
39
37
  lst.append(item)
40
38
 
41
39
 
42
40
  def to_dict(data: json or dict or None) -> dict:
43
- temp.deprecation_warning("to_dict","DELETE",date(2024,7,25))
41
+ deprecation_warning("to_dict", "DELETE", date(2024, 6, 5))
44
42
  if data is None:
45
43
  return {}
46
44
  if isinstance(data, dict):
47
45
  return data
48
- return json.loads(data)
46
+ return json.loads(data) # TODO: replace all `return statement` with `return identifier`
49
47
 
50
48
 
51
49
  def to_json(data: json or dict or None) -> json:
52
- temp.deprecation_warning("to_json","DELETE",date(2024,7,25))
50
+ deprecation_warning("to_json", "DELETE", date(2024, 6, 5))
53
51
  if data is None:
54
52
  data = {}
55
53
  if isinstance(data, dict):
@@ -58,7 +56,7 @@ def to_json(data: json or dict or None) -> json:
58
56
 
59
57
 
60
58
  def timedelta_to_time_format(time_delta: timedelta) -> str:
61
- temp.deprecation_warning("timedelta_to_time_format","DELETE",date(2024,7,25))
59
+ deprecation_warning("timedelta_to_time_format", "DELETE", date(2024, 6, 5))
62
60
  """
63
61
  Convert a timedelta to a time format in HH:MM:SS.
64
62
 
@@ -95,7 +93,7 @@ def timedelta_to_time_format(time_delta: timedelta) -> str:
95
93
 
96
94
 
97
95
  def is_valid_time_range(time_range: tuple) -> bool:
98
- temp.deprecation_warning("is_valid_time_range","DELETE",date(2024,7,25))
96
+ deprecation_warning("is_valid_time_range", "DELETE", date(2024, 6, 5))
99
97
  """
100
98
  Validate that the time range is in the format 'HH:MM:SS'.
101
99
  """
@@ -122,7 +120,7 @@ def is_valid_time_range(time_range: tuple) -> bool:
122
120
  # TODO shall we also use Url type and not only str? - Strongly Type which I prefer
123
121
  # (if yes we should change it also in all the calls to this function)
124
122
  def validate_url(url: str):
125
- temp.deprecation_warning("validate_url","DELETE",date(2024,7,25))
123
+ deprecation_warning("validate_url", "DELETE", date(2024, 6, 5))
126
124
  logger.start(object={"url": url})
127
125
  if url is not None or url != "":
128
126
  parsed_url = urlparse(url)
@@ -134,7 +132,7 @@ def validate_url(url: str):
134
132
 
135
133
 
136
134
  def is_valid_date_range(date_range: tuple) -> bool:
137
- temp.deprecation_warning("is_valid_date_range","DELETE",date(2024,7,25))
135
+ deprecation_warning("is_valid_date_range", "DELETE", date(2024, 6, 5))
138
136
  """
139
137
  Validate that the date range is in the format 'YYYY-MM-DD'.
140
138
  """
@@ -153,7 +151,7 @@ def is_valid_date_range(date_range: tuple) -> bool:
153
151
 
154
152
 
155
153
  def is_valid_datetime_range(datetime_range: (datetime, datetime)) -> bool:
156
- temp.deprecation_warning("is_valid_datetime_range","DELETE",date(2024,7,25))
154
+ deprecation_warning("is_valid_datetime_range", "DELETE", date(2024, 6, 5))
157
155
  """
158
156
  Validate that the datetime range is in the format 'YYYY-MM-DD HH:MM:SS'.
159
157
  """
@@ -171,7 +169,7 @@ def is_valid_datetime_range(datetime_range: (datetime, datetime)) -> bool:
171
169
 
172
170
 
173
171
  def is_list_of_dicts(obj: object) -> bool:
174
- temp.deprecation_warning("is_list_of_dicts","DELETE",date(2024,7,25))
172
+ deprecation_warning("is_list_of_dicts", "DELETE", date(2024, 6, 5))
175
173
  """
176
174
  Check if an object is a list of dictionaries.
177
175
 
@@ -216,7 +214,7 @@ def is_list_of_dicts(obj: object) -> bool:
216
214
 
217
215
 
218
216
  def is_time_in_time_range(check_time: time, time_range: tuple) -> bool:
219
- temp.deprecation_warning("is_time_in_time_range","DELETE",date(2024,7,25))
217
+ deprecation_warning("is_time_in_time_range", "DELETE", date(2024, 6, 5))
220
218
  """
221
219
  Check if the given time is within the specified time range.
222
220
 
@@ -240,7 +238,7 @@ def is_time_in_time_range(check_time: time, time_range: tuple) -> bool:
240
238
 
241
239
 
242
240
  def is_date_in_date_range(check_date: date, date_range: tuple) -> bool:
243
- temp.deprecation_warning("is_date_in_date_range","DELETE",date(2024,7,25))
241
+ deprecation_warning("is_date_in_date_range", "DELETE", date(2024, 6, 5))
244
242
  """
245
243
  Check if the given date is within the specified date range.
246
244
 
@@ -265,7 +263,7 @@ def is_date_in_date_range(check_date: date, date_range: tuple) -> bool:
265
263
 
266
264
 
267
265
  def is_datetime_in_datetime_range(check_datetime: datetime, datetime_range: (datetime, datetime)) -> bool:
268
- temp.deprecation_warning("is_datetime_in_datetime_range","DELETE",date(2024,7,25))
266
+ deprecation_warning("is_datetime_in_datetime_range", "DELETE", date(2024, 6, 5))
269
267
  """
270
268
  Check if the given datetime is within the specified datetime range.
271
269
 
@@ -329,7 +327,7 @@ def get_dialog_jwt_secret_key() -> str:
329
327
 
330
328
 
331
329
  def encode_jwt(payload: dict, key: str) -> str:
332
- temp.deprecation_warning("encode_jwt","DELETE",date(2024,7,25))
330
+ deprecation_warning("encode_jwt", "DELETE", date(2024, 6, 5))
333
331
  """Example:
334
332
  payload = {
335
333
  "user_id": 123,
@@ -341,7 +339,7 @@ def encode_jwt(payload: dict, key: str) -> str:
341
339
 
342
340
 
343
341
  def decode_jwt(token: str, key: str) -> dict:
344
- temp.deprecation_warning("decode_jwt","DELETE",date(2024,7,25))
342
+ deprecation_warning("decode_jwt", "DELETE", date(2024, 6, 5))
345
343
  """key can be private / public"""
346
344
  return jwt.decode(token, key, algorithms=['HS256'])
347
345
 
@@ -377,35 +375,35 @@ def obfuscate_log_dict(log_dict: dict) -> dict:
377
375
  # TODO: add tests to the following functions
378
376
 
379
377
  def remove_digits(text: str) -> str:
380
- temp.deprecation_warning("remove_digits","DELETE",date(2024,7,25))
378
+ deprecation_warning("remove_digits", "DELETE", date(2024, 6, 5))
381
379
  return ''.join(i for i in text if not i.isdigit())
382
380
 
383
381
 
384
382
  def generate_otp():
385
- temp.deprecation_warning("generate_otp","DELETE",date(2024,7,25))
383
+ deprecation_warning("generate_otp", "DELETE", date(2024, 6, 5))
386
384
  """Generates a 6-digit OTP"""
387
385
  otp = random.randint(100000, 999999)
388
386
  return otp
389
387
 
390
388
 
391
389
  def get_current_datetime_string(datetime_format: str = DEFAULT_DATETIME_FORMAT, tz: timezone = None) -> str:
392
- temp.deprecation_warning("get_current_datetime_string","DELETE",date(2024,7,25))
390
+ deprecation_warning("get_current_datetime_string", "DELETE", date(2024, 6, 5))
393
391
  current_datetime_string = datetime.now(tz).strftime(datetime_format)
394
392
  return current_datetime_string
395
393
 
396
394
 
397
395
  def datetime_from_str(date_str: str, datetime_format: str = DEFAULT_DATETIME_FORMAT) -> datetime:
398
- temp.deprecation_warning("datetime_from_str","DELETE",date(2024,7,25))
396
+ deprecation_warning("datetime_from_str", "DELETE", date(2024, 6, 5))
399
397
  return datetime.strptime(date_str, datetime_format)
400
398
 
401
399
 
402
400
  def datetime_to_str(input_datetime: datetime, datetime_format: str = DEFAULT_DATETIME_FORMAT) -> str:
403
- temp.deprecation_warning("datetime_to_str","DELETE",date(2024,7,25))
401
+ deprecation_warning("datetime_to_str", "DELETE", date(2024, 6, 5))
404
402
  return input_datetime.strftime(datetime_format)
405
403
 
406
404
 
407
405
  def validate_arguments(args: dict) -> None:
408
- temp.deprecation_warning("validate_arguments","DELETE",date(2024,7,25))
406
+ deprecation_warning("validate_arguments", "DELETE", date(2024, 6, 5))
409
407
  """
410
408
  Validate method arguments to ensure they are not None or ''
411
409
  :param args: arguments to be validated (usually locals())
@@ -417,7 +415,7 @@ def validate_arguments(args: dict) -> None:
417
415
 
418
416
 
419
417
  def reformat_time_string(input_str: str) -> str:
420
- temp.deprecation_warning("reformat_time_string","DELETE",date(2024,7,25))
418
+ deprecation_warning("reformat_time_string", "DELETE", date(2024, 6, 5))
421
419
  """Example:
422
420
  "1234" -> "12:34:00:00"
423
421
  """
@@ -431,12 +429,12 @@ def reformat_time_string(input_str: str) -> str:
431
429
 
432
430
 
433
431
  def get_ip_v4():
434
- temp.deprecation_warning("get_ip_v4","DELETE",date(2024,7,25))
432
+ deprecation_warning("get_ip_v4", "DELETE", date(2024, 6, 5))
435
433
  return requests.get('https://ipv4.seeip.org/jsonip').json()['ip']
436
434
 
437
435
 
438
436
  def get_ip_v6():
439
- temp.deprecation_warning("get_ip_v6","DELETE",date(2024,7,25))
437
+ deprecation_warning("get_ip_v6", "DELETE", date(2024, 6, 5))
440
438
  return requests.get('https://api.seeip.org/jsonip').json()['ip']
441
439
 
442
440
 
@@ -451,5 +449,3 @@ def camel_to_snake(camel_str: str) -> str:
451
449
  """Converts camelCase to snake_case."""
452
450
  snake_str = re.sub(r'(?<!^)(?=[A-Z])', '_', camel_str).lower()
453
451
  return snake_str
454
-
455
-
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-sdk-remote
3
- Version: 0.0.129
3
+ Version: 0.0.130
4
4
  Summary: PyPI Package for Circles Python SDK Local Python
5
5
  Home-page: https://github.com/circles-zone/python-sdk-remote-python-package
6
6
  Author: Circles
@@ -7,7 +7,7 @@ package_dir = PACKAGE_NAME.replace("-", "_")
7
7
  # python -m build needs pyproject.toml or setup.py
8
8
  setuptools.setup(
9
9
  name=PACKAGE_NAME,
10
- version='0.0.129', # https://pypi.org/project/python-sdk-remote/
10
+ version='0.0.130', # https://pypi.org/project/python-sdk-remote/
11
11
  author="Circles",
12
12
  author_email="info@circlez.ai",
13
13
  description="PyPI Package for Circles Python SDK Local Python",