arpakitlib 1.8.294__py3-none-any.whl → 1.8.298__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 arpakitlib might be problematic. Click here for more details.

@@ -0,0 +1,21 @@
1
+ # arpakit
2
+
3
+ _ARPAKIT_LIB_MODULE_VERSION = "3.0"
4
+
5
+ import logging
6
+
7
+ _logger = logging.getLogger()
8
+
9
+
10
+ async def log_async_func_if_error(async_func, **kwargs):
11
+ try:
12
+ await async_func(**kwargs)
13
+ except Exception as exception:
14
+ _logger.error(
15
+ f"error in async_func, {async_func.__name__=}",
16
+ exc_info=exception,
17
+ extra={
18
+ "log_async_func_if_error": True,
19
+ "async_func_name": async_func.__name__
20
+ }
21
+ )
@@ -7,7 +7,9 @@ from typing import Optional
7
7
  _ARPAKIT_LIB_MODULE_VERSION = "3.0"
8
8
 
9
9
 
10
- def init_log_file(*, log_filepath: str, write_blank: bool = True):
10
+ def init_log_file(*, log_filepath: str | None):
11
+ if not log_filepath:
12
+ return
11
13
  directory = os.path.dirname(log_filepath)
12
14
  if directory and not os.path.exists(directory):
13
15
  os.makedirs(directory, exist_ok=True)
@@ -19,13 +21,16 @@ def init_log_file(*, log_filepath: str, write_blank: bool = True):
19
21
  _logging_was_setup: bool = False
20
22
 
21
23
 
22
- def setup_normal_logging(log_filepath: Optional[str] = None):
24
+ def setup_normal_logging(
25
+ *,
26
+ log_filepath: Optional[str] = None,
27
+ ):
23
28
  global _logging_was_setup
24
29
  if _logging_was_setup:
30
+ logging.getLogger().info("normal logging was already setup")
25
31
  return
26
32
 
27
- if log_filepath:
28
- init_log_file(log_filepath=log_filepath)
33
+ init_log_file(log_filepath=log_filepath)
29
34
 
30
35
  logger = logging.getLogger()
31
36
  logger.setLevel(logging.INFO)
@@ -33,8 +38,9 @@ def setup_normal_logging(log_filepath: Optional[str] = None):
33
38
  stream_handler = logging.StreamHandler()
34
39
  stream_handler.setLevel(logging.INFO)
35
40
  stream_formatter = logging.Formatter(
36
- "%(asctime)s %(msecs)03d | %(levelname)s | %(filename)s | %(funcName)s:%(lineno)d - %(message)s",
37
- datefmt="%d.%m.%Y %I:%M:%S %p"
41
+ "%(asctime)s %(msecs)03d | %(levelname)s | %(name)s | %(filename)s | "
42
+ "%(funcName)s:%(lineno)d - %(message)s",
43
+ datefmt="%d.%m.%Y %H:%M:%S %p %Z %z",
38
44
  )
39
45
  stream_handler.setFormatter(stream_formatter)
40
46
  logger.addHandler(stream_handler)
@@ -44,7 +50,7 @@ def setup_normal_logging(log_filepath: Optional[str] = None):
44
50
  file_handler.setLevel(logging.WARNING)
45
51
  file_formatter = logging.Formatter(
46
52
  "%(asctime)s | %(levelname)s | %(filename)s | %(funcName)s:%(lineno)d - %(message)s",
47
- datefmt="%d.%m.%Y %I:%M:%S%p"
53
+ datefmt="%d.%m.%Y %H:%M:%S %p %Z %z",
48
54
  )
49
55
  file_handler.setFormatter(file_formatter)
50
56
  logger.addHandler(file_handler)
@@ -55,7 +61,9 @@ def setup_normal_logging(log_filepath: Optional[str] = None):
55
61
 
56
62
 
57
63
  def __example():
58
- pass
64
+ setup_normal_logging()
65
+ logging.getLogger().info("Hello world")
66
+ logging.getLogger().error("Hello world")
59
67
 
60
68
 
61
69
  if __name__ == '__main__':
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: arpakitlib
3
- Version: 1.8.294
3
+ Version: 1.8.298
4
4
  Summary: arpakitlib
5
5
  License: Apache-2.0
6
6
  License-File: LICENSE
@@ -33,7 +33,6 @@ Requires-Dist: emoji (>=2.14.1,<3.0.0)
33
33
  Requires-Dist: fastapi (>=0.118.0,<0.119.0)
34
34
  Requires-Dist: gunicorn (>=23.0.0,<24.0.0)
35
35
  Requires-Dist: itsdangerous (>=2.2.0,<3.0.0)
36
- Requires-Dist: jupyter (>=1.1.1,<2.0.0)
37
36
  Requires-Dist: markdown (>=3.7,<4.0)
38
37
  Requires-Dist: openai (>=2.2.0,<3.0.0)
39
38
  Requires-Dist: openpyxl (>=3.1.5,<4.0.0)
@@ -52,13 +51,11 @@ Requires-Dist: pymongo (>=4.10.1,<5.0.0)
52
51
  Requires-Dist: pytelegrambotapi (>=4.27.0,<5.0.0)
53
52
  Requires-Dist: pytest (>=8.4.2,<9.0.0)
54
53
  Requires-Dist: pytz (>=2024.2,<2025.0)
55
- Requires-Dist: pyzabbix (>=1.3.1,<2.0.0)
56
54
  Requires-Dist: qrcode (>=8.2,<9.0)
57
55
  Requires-Dist: rapidfuzz (>=3.14.1,<4.0.0)
58
56
  Requires-Dist: redis (>=6.4.0,<7.0.0)
59
57
  Requires-Dist: requests-ntlm (>=1.3.0,<2.0.0)
60
58
  Requires-Dist: requests[socks] (>=2.32.3,<3.0.0)
61
- Requires-Dist: scipy (>=1.15.1,<2.0.0)
62
59
  Requires-Dist: speechrecognition (>=3.14.3,<4.0.0)
63
60
  Requires-Dist: sqladmin (>=0.21.0,<0.22.0)
64
61
  Requires-Dist: sqlalchemy (>=2.0.37,<3.0.0)
@@ -75,7 +72,7 @@ Description-Content-Type: text/markdown
75
72
 
76
73
  # arpakitlib
77
74
 
78
- ## Текущая версия шаблона arpakit_project_template_v_5 находится в разработке. В скором времени будет stable version.
75
+ ## Текущая версия шаблона arpakit_project_template_v_5 находится в разработке, она неверная. В скором времени будет stable version.
79
76
 
80
77
  ## 🚀 Simplify Your Development Workflow
81
78
 
@@ -409,7 +409,8 @@ arpakitlib/ar_json_util.py,sha256=jnVfpQ6QSDq8NgIlh_6ZzXDveOiybr7QSQkXutE7d2s,26
409
409
  arpakitlib/ar_jwt_util.py,sha256=Rhm4ywoTAn6yOV8NLjDASfAtAtheROxxDP40G3XjnuQ,761
410
410
  arpakitlib/ar_list_of_dicts_to_xlsx.py,sha256=MyjEl4Jl4beLVZqLVQMMv0-XDtBD3Xh4Z_ZPDJeFu04,745
411
411
  arpakitlib/ar_list_util.py,sha256=xaUk2BnLvDMP5HDh_GFfH-nIXCg-f8NsrrUKXRcVUsU,1788
412
- arpakitlib/ar_logging_util.py,sha256=CvKvaKqsl1UucgwL28cWadK9f6t5vaF2DmwbZMa8FmU,1681
412
+ arpakitlib/ar_log_async_func_if_error.py,sha256=qtr_eK9o1BrcA_7S9Ns7nVmOS81Yv6eMXHdasc4MftQ,495
413
+ arpakitlib/ar_logging_util.py,sha256=X9PxY04dpJCTaahE3zKMMAwZMeu8k848dyrlIX3ENpk,1912
413
414
  arpakitlib/ar_mongodb_util.py,sha256=2ECkTnGAZ92qxioL-fmN6R4yZOSr3bXdXLWTzT1C3vk,4038
414
415
  arpakitlib/ar_need_type_util.py,sha256=XmY1kswz8j9oo5f9CxRu0_zgfvxWrXPYKOj6MM04sGk,2604
415
416
  arpakitlib/ar_openai_api_client_util.py,sha256=dWgsSPXtxNBxS5VRi_NharGQrUXF_YjIfhU3Bj5cW9M,5651
@@ -431,9 +432,9 @@ arpakitlib/ar_sqlalchemy_drop_check_constraints.py,sha256=XEqnMrIwSYasW_UOJ8xU-J
431
432
  arpakitlib/ar_sqlalchemy_util.py,sha256=vWNCzFv13YsGRZaemkNI1_BF__4Z1_Vqm-gqQL1PRrQ,17034
432
433
  arpakitlib/ar_str_util.py,sha256=2lGpnXDf2h1cBZpVf5i1tX_HCv5iBd6IGnrCw4QWWlY,4350
433
434
  arpakitlib/ar_type_util.py,sha256=Cs_tef-Fc5xeyAF54KgISCsP11NHyzIsglm4S3Xx7iM,4049
434
- arpakitlib/uppercase_env_keys.py,sha256=UFHLGIR70UB02eD7IAIBrZIbycwWCx3OP_W4J2cx2Jw,2395
435
- arpakitlib-1.8.294.dist-info/METADATA,sha256=zuyMTr_yvhK0_nw9UVafNkEGhx2ciC7zvoHnKQUQTKI,4061
436
- arpakitlib-1.8.294.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
437
- arpakitlib-1.8.294.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
438
- arpakitlib-1.8.294.dist-info/licenses/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
439
- arpakitlib-1.8.294.dist-info/RECORD,,
435
+ arpakitlib/ar_uppercase_env_keys.py,sha256=UFHLGIR70UB02eD7IAIBrZIbycwWCx3OP_W4J2cx2Jw,2395
436
+ arpakitlib-1.8.298.dist-info/METADATA,sha256=IuHbx9gg1RmssnSO68aNtQHaC3qmNa2XoBM7QR8434g,3966
437
+ arpakitlib-1.8.298.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
438
+ arpakitlib-1.8.298.dist-info/entry_points.txt,sha256=36xqR3PJFT2kuwjkM_EqoIy0qFUDPKSm_mJaI7emewE,87
439
+ arpakitlib-1.8.298.dist-info/licenses/LICENSE,sha256=GPEDQMam2r7FSTYqM1mm7aKnxLaWcBotH7UvQtea-ec,11355
440
+ arpakitlib-1.8.298.dist-info/RECORD,,