arpakitlib 1.6.75__tar.gz → 1.6.78__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 (111) hide show
  1. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/PKG-INFO +4 -2
  2. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/README.md +1 -1
  3. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_ar_arpakitlib_cli.py +11 -4
  4. arpakitlib-1.6.78/arpakitlib/_arpakit_project_template/README.md +6 -0
  5. arpakitlib-1.6.75/arpakitlib/_arpakit_project_template/manage/git_push_dev_arpakit_company_github_1.sh → arpakitlib-1.6.78/arpakitlib/_arpakit_project_template/manage/git_push_arpakit_company_github_1.sh +1 -1
  6. arpakitlib-1.6.75/arpakitlib/_arpakit_project_template/manage/git_push_dev_arpakit_company_gitlab_1.sh → arpakitlib-1.6.78/arpakitlib/_arpakit_project_template/manage/git_push_arpakit_company_gitlab_1.sh +1 -1
  7. arpakitlib-1.6.75/arpakitlib/_arpakit_project_template/pyproject.toml → arpakitlib-1.6.78/arpakitlib/_arpakit_project_template/pyproject.toml.example +1 -1
  8. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_aiogram_util.py +1 -1
  9. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_base_worker_util.py +28 -0
  10. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_fastapi_util.py +3 -24
  11. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_need_type_util.py +4 -1
  12. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_project_template_util.py +24 -5
  13. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/pyproject.toml +3 -1
  14. arpakitlib-1.6.75/arpakitlib/_arpakit_project_template/README.md +0 -6
  15. arpakitlib-1.6.75/arpakitlib/_arpakit_project_template/src/util/__init__.py +0 -0
  16. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/LICENSE +0 -0
  17. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/NOTICE +0 -0
  18. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/__init__.py +0 -0
  19. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/.env_example +0 -0
  20. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/.gitignore +0 -0
  21. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/.python-version +0 -0
  22. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/AUTHOR.md +0 -0
  23. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/LICENSE +0 -0
  24. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/NOTICE +0 -0
  25. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/manage/__init__.py +0 -0
  26. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/manage/beutify_json.py +0 -0
  27. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/manage/docker_ps.sh +0 -0
  28. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/manage/generate_env_example.py +0 -0
  29. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/manage/git_commit.sh +0 -0
  30. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/manage/git_remote_v.sh +0 -0
  31. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/manage/git_set_arpakit_company_origin.sh +0 -0
  32. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/manage/git_status.sh +0 -0
  33. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/manage/hello_world.py +0 -0
  34. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/manage/poetry_add_plugin_export.sh +0 -0
  35. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/manage/poetry_check.sh +0 -0
  36. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/manage/poetry_clear_cache.sh +0 -0
  37. /arpakitlib-1.6.75/arpakitlib/_arpakit_project_template/manage/poetry_config_virtualenvs.in-project_true.sh → /arpakitlib-1.6.78/arpakitlib/_arpakit_project_template/manage/poetry_config_virtualenvs_in_project_true.sh +0 -0
  38. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/manage/poetry_generate_requirements.txt.sh +0 -0
  39. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/manage/poetry_install.sh +0 -0
  40. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/manage/poetry_lock.sh +0 -0
  41. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/manage/poetry_remove_and_add_arpakitlib.sh +0 -0
  42. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/manage/poetry_show.sh +0 -0
  43. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/manage/poetry_update.sh +0 -0
  44. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/manage/poetry_update_arpakitlib.sh +0 -0
  45. {arpakitlib-1.6.75/arpakitlib/_arpakit_project_template/manage/src → arpakitlib-1.6.78/arpakitlib/_arpakit_project_template/resource}/__init__.py +0 -0
  46. {arpakitlib-1.6.75/arpakitlib/_arpakit_project_template/resource → arpakitlib-1.6.78/arpakitlib/_arpakit_project_template/src}/__init__.py +0 -0
  47. {arpakitlib-1.6.75/arpakitlib/_arpakit_project_template/src → arpakitlib-1.6.78/arpakitlib/_arpakit_project_template/src/additional_model}/__init__.py +0 -0
  48. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/src/additional_model/additional_model.py +0 -0
  49. {arpakitlib-1.6.75/arpakitlib/_arpakit_project_template/src/additional_model → arpakitlib-1.6.78/arpakitlib/_arpakit_project_template/src/business_service}/__init__.py +0 -0
  50. {arpakitlib-1.6.75/arpakitlib/_arpakit_project_template/src/business_service → arpakitlib-1.6.78/arpakitlib/_arpakit_project_template/src/core}/__init__.py +0 -0
  51. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/src/core/const.py +0 -0
  52. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/src/core/settings.py +0 -0
  53. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/_arpakit_project_template/src/core/util.py +0 -0
  54. {arpakitlib-1.6.75/arpakitlib/_arpakit_project_template/src/core → arpakitlib-1.6.78/arpakitlib/_arpakit_project_template/src/util}/__init__.py +0 -0
  55. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_additional_model_util.py +0 -0
  56. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_arpakit_lib_module_util.py +0 -0
  57. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_arpakit_schedule_uust_api_client_util.py +0 -0
  58. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_base64_util.py +0 -0
  59. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_cache_file_util.py +0 -0
  60. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_datetime_util.py +0 -0
  61. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_dict_util.py +0 -0
  62. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_dream_ai_api_client_util.py +0 -0
  63. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_encrypt_decrypt_util.py +0 -0
  64. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_enumeration_util.py +0 -0
  65. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_fastapi_static/redoc/redoc.standalone.js +0 -0
  66. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_fastapi_static/swagger-ui/favicon-16x16.png +0 -0
  67. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_fastapi_static/swagger-ui/favicon-32x32.png +0 -0
  68. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_fastapi_static/swagger-ui/index.css +0 -0
  69. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_fastapi_static/swagger-ui/index.html +0 -0
  70. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_fastapi_static/swagger-ui/oauth2-redirect.html +0 -0
  71. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-initializer.js +0 -0
  72. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-bundle.js +0 -0
  73. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-bundle.js.map +0 -0
  74. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-es-bundle-core.js +0 -0
  75. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-es-bundle-core.js.map +0 -0
  76. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-es-bundle.js +0 -0
  77. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-es-bundle.js.map +0 -0
  78. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-standalone-preset.js +0 -0
  79. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-standalone-preset.js.map +0 -0
  80. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.css +0 -0
  81. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.css.map +0 -0
  82. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js +0 -0
  83. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js.map +0 -0
  84. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_file_storage_in_dir_util.py +0 -0
  85. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_file_util.py +0 -0
  86. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_hash_util.py +0 -0
  87. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_hello_world.py +0 -0
  88. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_http_request_util.py +0 -0
  89. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_ip_util.py +0 -0
  90. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_json_db_util.py +0 -0
  91. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_json_util.py +0 -0
  92. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_jwt_util.py +0 -0
  93. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_list_of_dicts_to_xlsx.py +0 -0
  94. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_list_util.py +0 -0
  95. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_logging_util.py +0 -0
  96. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_mongodb_util.py +0 -0
  97. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_openai_util.py +0 -0
  98. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_operation_execution_util.py +0 -0
  99. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_parse_command.py +0 -0
  100. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_postgresql_util.py +0 -0
  101. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_run_cmd_util.py +0 -0
  102. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_schedule_uust_api_client_util.py +0 -0
  103. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_settings_util.py +0 -0
  104. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_sleep_util.py +0 -0
  105. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_sqlalchemy_model_util.py +0 -0
  106. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_sqlalchemy_util.py +0 -0
  107. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_ssh_util.py +0 -0
  108. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_str_util.py +0 -0
  109. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_type_util.py +0 -0
  110. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_yookassa_api_client_util.py +0 -0
  111. {arpakitlib-1.6.75 → arpakitlib-1.6.78}/arpakitlib/ar_zabbix_util.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: arpakitlib
3
- Version: 1.6.75
3
+ Version: 1.6.78
4
4
  Summary: arpakitlib
5
5
  Home-page: https://github.com/ARPAKIT-Company/arpakitlib
6
6
  License: Apache-2.0
@@ -30,6 +30,8 @@ Requires-Dist: email-validator (>=2.2.0,<3.0.0)
30
30
  Requires-Dist: fastapi (>=0.115.5,<0.116.0)
31
31
  Requires-Dist: gunicorn (>=23.0.0,<24.0.0)
32
32
  Requires-Dist: itsdangerous (>=2.2.0,<3.0.0)
33
+ Requires-Dist: jupyter (>=1.1.1,<2.0.0)
34
+ Requires-Dist: matplotlib (>=3.10.0,<4.0.0)
33
35
  Requires-Dist: openai (>=1.55.3,<2.0.0)
34
36
  Requires-Dist: pandas (>=2.2.3,<3.0.0)
35
37
  Requires-Dist: paramiko (>=3.5.0,<4.0.0)
@@ -86,6 +88,6 @@ pip install arpakitlib
86
88
 
87
89
  ---
88
90
 
89
- ## ❤️ Made with Care by ARPAKIT Company ❤️
91
+ ## ❤️ Made by ARPAKIT Company ❤️
90
92
 
91
93
 
@@ -35,5 +35,5 @@ pip install arpakitlib
35
35
 
36
36
  ---
37
37
 
38
- ## ❤️ Made with Care by ARPAKIT Company ❤️
38
+ ## ❤️ Made by ARPAKIT Company ❤️
39
39
 
@@ -25,23 +25,30 @@ def _arpakitlib_cli(*, full_command: str | None = None):
25
25
  print(
26
26
  "Commands:"
27
27
  "\n- init_arpakit_project_template"
28
- " (project_dirpath, remove_if_exists, project_name, ignore_src_dir, ignore_manage_dir)"
28
+ " (project_dirpath, overwrite_if_exists, project_name, ignore_paths_startswith, only_paths_startswith)"
29
29
  )
30
30
 
31
31
  elif command == "init_arpakit_project_template":
32
32
  project_dirpath = raise_if_blank(parsed_command.get_value_by_keys(keys=["pd", "project_dirpath"]))
33
33
  overwrite_if_exists: bool = parse_need_type(
34
34
  value=parsed_command.get_value_by_keys(keys=["oie", "overwrite_if_exists"]),
35
- need_type=NeedTypes.bool_
35
+ need_type=NeedTypes.bool_,
36
+ allow_none=False
36
37
  )
37
38
  project_name: str = parsed_command.get_value_by_keys(keys=["pm", "project_name"])
38
39
  ignore_paths_startswith: list[str] | None = parse_need_type(
39
40
  value=parsed_command.get_value_by_keys(keys=["ipsw", "ignore_paths_startswith"]),
40
- need_type=NeedTypes.list_of_str
41
+ need_type=NeedTypes.list_of_str,
42
+ allow_none=True
43
+ )
44
+ only_paths_startswith: list[str] | None = parse_need_type(
45
+ value=parsed_command.get_value_by_keys(keys=["ops", "only_paths_startswith"]),
46
+ need_type=NeedTypes.list_of_str,
47
+ allow_none=True
41
48
  )
42
49
  init_arpakit_project_template(
43
50
  project_dirpath=project_dirpath, overwrite_if_exists=overwrite_if_exists, project_name=project_name,
44
- ignore_paths_startswith=ignore_paths_startswith
51
+ ignore_paths_startswith=ignore_paths_startswith, only_paths_startswith=only_paths_startswith
45
52
  )
46
53
 
47
54
  else:
@@ -0,0 +1,6 @@
1
+ # {PROJECT_NAME}
2
+
3
+ ....
4
+
5
+ ## ❤️ Made by ARPAKIT Company ❤️
6
+
@@ -1,4 +1,4 @@
1
1
  cd ..
2
2
  git add .
3
3
  git commit -m "no_message"
4
- git push arpakit_company_github_1 dev
4
+ git push arpakit_company_github_1
@@ -1,4 +1,4 @@
1
1
  cd ..
2
2
  git add .
3
3
  git commit -m "no_message"
4
- git push arpakit_company_gitlab_1 dev
4
+ git push arpakit_company_gitlab_1
@@ -5,7 +5,7 @@ description = "{PROJECT_NAME}"
5
5
  authors = ["arpakit <arpakit@gmail.com>", "arpakit_support <support@arpakit.com>"]
6
6
  license = "Apache License 2.0"
7
7
  readme = "README.md"
8
- keywords = ["{PROJECT_NAME}", "arpakit", "arpakit-company", "arpakitcompany", "arpakit_company"]
8
+ keywords = ["{PROJECT_NAME}", "arpakitlib", "arpakit", "arpakit-company", "arpakitcompany", "arpakit_company"]
9
9
  package-mode = false
10
10
 
11
11
 
@@ -293,7 +293,7 @@ def as_tg_command(
293
293
  f"Value (key={_param.key}, index={_param.index}) is required"
294
294
  )
295
295
  else:
296
- value = parse_need_type(value=value, need_type=_param.need_type)
296
+ value = parse_need_type(value=value, need_type=_param.need_type, allow_none=False)
297
297
 
298
298
  kwargs[_param.key] = value
299
299
 
@@ -2,15 +2,22 @@
2
2
 
3
3
  import asyncio
4
4
  import logging
5
+ import multiprocessing
6
+ import threading
5
7
  from abc import ABC
6
8
  from datetime import timedelta
7
9
 
10
+ from arpakitlib.ar_enumeration_util import Enumeration
8
11
  from arpakitlib.ar_sleep_util import sync_safe_sleep, async_safe_sleep
9
12
 
10
13
  _ARPAKIT_LIB_MODULE_VERSION = "3.0"
11
14
 
12
15
 
13
16
  class BaseWorker(ABC):
17
+ class SafeRunInBackgroundModes(Enumeration):
18
+ async_task = "async_task"
19
+ thread = "thread"
20
+ process = "process"
14
21
 
15
22
  def __init__(self):
16
23
  self.worker_name = self.__class__.__name__
@@ -18,6 +25,27 @@ class BaseWorker(ABC):
18
25
  self.timeout_after_run = timedelta(seconds=0.1).total_seconds()
19
26
  self.timeout_after_err_in_run = timedelta(seconds=1).total_seconds()
20
27
 
28
+ def safe_run_in_background(self, *, safe_run_in_background_mode: str) -> (
29
+ asyncio.Task | threading.Thread | multiprocessing.Process
30
+ ):
31
+ if safe_run_in_background_mode == self.SafeRunInBackgroundModes.async_task:
32
+ res: asyncio.Task = asyncio.create_task(self.async_safe_run())
33
+ elif safe_run_in_background_mode == self.SafeRunInBackgroundModes.thread:
34
+ res: threading.Thread = threading.Thread(
35
+ target=self.sync_safe_run,
36
+ daemon=True
37
+ )
38
+ res.start()
39
+ elif safe_run_in_background_mode == self.SafeRunInBackgroundModes.process:
40
+ res: multiprocessing.Process = multiprocessing.Process(
41
+ target=self.sync_safe_run,
42
+ daemon=True
43
+ )
44
+ res.start()
45
+ else:
46
+ raise ValueError(f"unrecognized safe_run_mode={safe_run_in_background_mode}")
47
+ return res
48
+
21
49
  def sync_on_startup(self):
22
50
  pass
23
51
 
@@ -4,10 +4,8 @@ from __future__ import annotations
4
4
 
5
5
  import asyncio
6
6
  import logging
7
- import multiprocessing
8
7
  import os.path
9
8
  import pathlib
10
- import threading
11
9
  import traceback
12
10
  from datetime import datetime
13
11
  from typing import Any, Callable
@@ -403,33 +401,14 @@ class InitSqlalchemyDBStartupAPIEvent(BaseStartupAPIEvent):
403
401
  self.sqlalchemy_db.init()
404
402
 
405
403
 
406
- class SafeRunWorkerModes(Enumeration):
407
- async_task = "async_task"
408
- thread = "thread"
409
- process = "process"
410
-
411
-
412
404
  class SafeRunWorkerStartupAPIEvent(BaseStartupAPIEvent):
413
- def __init__(self, worker: BaseWorker, safe_run_mode: str):
405
+ def __init__(self, worker: BaseWorker, safe_run_in_background_mode: str):
414
406
  super().__init__()
415
407
  self.worker = worker
416
- self.safe_run_mode = safe_run_mode
408
+ self.safe_run_in_background_mode = safe_run_in_background_mode
417
409
 
418
410
  def async_on_startup(self, *args, **kwargs):
419
- if self.safe_run_mode == SafeRunWorkerModes.async_task:
420
- _ = asyncio.create_task(self.worker.async_safe_run())
421
- elif self.safe_run_mode == SafeRunWorkerModes.thread:
422
- thread = threading.Thread(
423
- target=self.worker.sync_safe_run,
424
- daemon=True
425
- )
426
- thread.start()
427
- elif self.safe_run_mode == SafeRunWorkerModes.process:
428
- process = multiprocessing.Process(
429
- target=self.worker.sync_safe_run,
430
- daemon=True
431
- )
432
- process.start()
411
+ self.worker.safe_run_in_background(safe_run_in_background_mode=self.safe_run_in_background_mode)
433
412
 
434
413
 
435
414
  class BaseTransmittedAPIData(BaseModel):
@@ -19,7 +19,10 @@ class NeedTypes(Enumeration):
19
19
  json = "json"
20
20
 
21
21
 
22
- def parse_need_type(value: Any, need_type: str) -> Any:
22
+ def parse_need_type(value: Any, need_type: str, allow_none: bool = False) -> Any:
23
+ if allow_none and value is None:
24
+ return None
25
+
23
26
  NeedTypes.parse_and_validate_values(need_type)
24
27
 
25
28
  if need_type == NeedTypes.str_:
@@ -15,7 +15,8 @@ def init_arpakit_project_template(
15
15
  project_dirpath: str,
16
16
  overwrite_if_exists: bool = False,
17
17
  project_name: str | None = None,
18
- ignore_paths_startswith: list[str] | str | None = None
18
+ ignore_paths_startswith: list[str] | str | None = None,
19
+ only_paths_startswith: list[str] | str | None = None
19
20
  ):
20
21
  if project_name:
21
22
  project_name = project_name.strip()
@@ -26,17 +27,35 @@ def init_arpakit_project_template(
26
27
  if ignore_paths_startswith is None:
27
28
  ignore_paths_startswith = []
28
29
 
30
+ if isinstance(only_paths_startswith, str):
31
+ only_paths_startswith = [only_paths_startswith]
32
+ if only_paths_startswith is None:
33
+ only_paths_startswith = []
34
+
29
35
  def _generate_filepath_to_content() -> dict[str, str]:
30
- arpakit_project_template_dirpath = os.path.abspath("_arpakit_project_template")
36
+ arpakit_project_template_dirpath = os.path.join(
37
+ os.path.dirname(os.path.abspath(__file__)), "_arpakit_project_template"
38
+ )
31
39
  res = {}
32
40
  for root, dirs, files in os.walk(arpakit_project_template_dirpath):
33
41
  dirs[:] = [d for d in dirs if d != '__pycache__']
34
42
  for file in files:
35
43
  rel_path = os.path.relpath(os.path.join(root, file), arpakit_project_template_dirpath)
36
- if any(rel_path.startswith(ignore_path) for ignore_path in ignore_paths_startswith):
37
- _logger.info(f"Ignoring file: {rel_path}")
44
+ if (
45
+ ignore_paths_startswith
46
+ and
47
+ any(rel_path.startswith(ignore_path) for ignore_path in ignore_paths_startswith)
48
+ ):
49
+ _logger.info(f"ignoring file: {rel_path}")
50
+ continue
51
+ if (
52
+ only_paths_startswith
53
+ and
54
+ not any(rel_path.startswith(only_path) for only_path in only_paths_startswith)
55
+ ):
56
+ _logger.info(f"ignoring file: {rel_path}")
38
57
  continue
39
- with open(os.path.join(root, file), "r", encoding='utf-8') as _file:
58
+ with open(os.path.join(root, file), "r", encoding="utf-8") as _file:
40
59
  _content = _file.read()
41
60
  if project_name:
42
61
  _content = _content.replace("{PROJECT_NAME}", project_name)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "arpakitlib"
3
- version = "1.6.75"
3
+ version = "1.6.78"
4
4
  description = "arpakitlib"
5
5
  authors = ["arpakit <arpakit@gmail.com>", "arpakit_support <support@arpakit.com>"]
6
6
  license = "Apache License 2.0"
@@ -51,6 +51,8 @@ twine = "^6.0.1"
51
51
  itsdangerous = "^2.2.0"
52
52
  email-validator = "^2.2.0"
53
53
 
54
+ jupyter = "^1.1.1"
55
+ matplotlib = "^3.10.0"
54
56
  [[tool.poetry.source]]
55
57
  name = "testpypi"
56
58
  url = "https://test.pypi.org/legacy/"
@@ -1,6 +0,0 @@
1
- # {PROJECT_NAME}
2
-
3
- ....
4
-
5
- ## ❤️ Made with Care by ARPAKIT Company ❤️
6
-
File without changes
File without changes