arpakitlib 1.7.257__py3-none-any.whl → 1.8.1__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.
- arpakitlib/{_arpakit_project_template → _arpakit_project_template_v_1}/README.md +1 -1
- arpakitlib/{_arpakit_project_template → _arpakit_project_template_v_1}/alembic/env.py +3 -3
- arpakitlib/_arpakit_project_template_v_1/api/asgi.py +3 -0
- arpakitlib/_arpakit_project_template_v_1/api/auth.py +235 -0
- arpakitlib/_arpakit_project_template_v_1/api/const.py +18 -0
- arpakitlib/_arpakit_project_template_v_1/api/create_api_app.py +71 -0
- arpakitlib/_arpakit_project_template_v_1/api/event.py +74 -0
- arpakitlib/_arpakit_project_template_v_1/api/exception.py +38 -0
- arpakitlib/_arpakit_project_template_v_1/api/exception_handler.py +308 -0
- arpakitlib/_arpakit_project_template_v_1/api/openapi_ui.py +28 -0
- arpakitlib/_arpakit_project_template_v_1/api/response.py +31 -0
- arpakitlib/{_arpakit_project_template/src → _arpakit_project_template_v_1}/api/router/main_router.py +4 -3
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/arpakit_project_template.py +22 -0
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/check_auth.py +30 -0
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/clear_log_file.py +25 -0
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/get_errors_info.py +24 -0
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/get_log_file.py +23 -0
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/healthcheck.py +21 -0
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/main_router.py +67 -0
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/now_utc_datetime.py +21 -0
- arpakitlib/_arpakit_project_template_v_1/api/router/v1/raise_fake_error.py +35 -0
- arpakitlib/_arpakit_project_template_v_1/api/schema/base_schema.py +26 -0
- arpakitlib/_arpakit_project_template_v_1/api/schema/common/in_.py +5 -0
- arpakitlib/_arpakit_project_template_v_1/api/schema/common/out.py +60 -0
- arpakitlib/_arpakit_project_template_v_1/api/schema/v1/in_.py +5 -0
- arpakitlib/_arpakit_project_template_v_1/api/schema/v1/out.py +47 -0
- arpakitlib/_arpakit_project_template_v_1/arpakitlib_project_template.json +3 -0
- arpakitlib/{_arpakit_project_template/src → _arpakit_project_template_v_1}/business_service/hello_world.py +1 -1
- arpakitlib/_arpakit_project_template_v_1/business_service/remove_operations.py +51 -0
- arpakitlib/_arpakit_project_template_v_1/command/alembic_history.sh +2 -0
- arpakitlib/_arpakit_project_template_v_1/command/alembic_revision_autogenerate.sh +2 -0
- arpakitlib/{_arpakit_project_template/manage/json_beautify.py → _arpakit_project_template_v_1/command/beautify_json.py} +2 -2
- arpakitlib/{_arpakit_project_template/src/core/_check_logging.py → _arpakit_project_template_v_1/command/check_logging.py} +3 -3
- arpakitlib/_arpakit_project_template_v_1/command/check_sqlalchemy_db.py +11 -0
- arpakitlib/_arpakit_project_template_v_1/command/drop_json_db.py +13 -0
- arpakitlib/_arpakit_project_template_v_1/command/drop_sqlalchemy_db.py +14 -0
- arpakitlib/{_arpakit_project_template/src/core/_generate_settings_env_example.py → _arpakit_project_template_v_1/command/generate_settings_env_example.py} +4 -4
- arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/hello_world.py +2 -2
- arpakitlib/_arpakit_project_template_v_1/command/init_json_db.py +11 -0
- arpakitlib/_arpakit_project_template_v_1/command/init_sqlalchemy_db.py +11 -0
- arpakitlib/_arpakit_project_template_v_1/command/reinit_json_db.py +13 -0
- arpakitlib/_arpakit_project_template_v_1/command/reinit_sqlalchemy_db.py +13 -0
- arpakitlib/_arpakit_project_template_v_1/command/remove_operations.py +13 -0
- arpakitlib/_arpakit_project_template_v_1/command/remove_story_logs.py +16 -0
- arpakitlib/_arpakit_project_template_v_1/command/rm_all_records_in_json_db.py +13 -0
- arpakitlib/{_arpakit_project_template/src/core/_show_settings.py → _arpakit_project_template_v_1/command/show_settings.py} +3 -3
- arpakitlib/{_arpakit_project_template/src/api/_start_api_with_reload.py → _arpakit_project_template_v_1/command/start_api_with_reload.py} +5 -5
- arpakitlib/{_arpakit_project_template/src/api/_start_api_without_reload.py → _arpakit_project_template_v_1/command/start_api_without_reload.py} +5 -5
- arpakitlib/_arpakit_project_template_v_1/command/start_async_operation_executor_worker.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/command/start_async_scheduled_operation_creator_worker.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/command/start_sync_operation_executor_worker.py +15 -0
- arpakitlib/_arpakit_project_template_v_1/command/start_sync_operation_executor_workers.py +22 -0
- arpakitlib/_arpakit_project_template_v_1/command/start_sync_scheduled_operation_creator_worker.py +12 -0
- arpakitlib/_arpakit_project_template_v_1/core/cache_file_storage_in_dir.py +23 -0
- arpakitlib/_arpakit_project_template_v_1/core/const.py +33 -0
- arpakitlib/_arpakit_project_template_v_1/core/dump_file_storage_in_dir.py +23 -0
- arpakitlib/_arpakit_project_template_v_1/core/jinja2_templates.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/core/media_file_storage_in_dir.py +23 -0
- arpakitlib/_arpakit_project_template_v_1/core/settings.py +195 -0
- arpakitlib/_arpakit_project_template_v_1/core/util.py +29 -0
- arpakitlib/{_arpakit_project_template → _arpakit_project_template_v_1}/example.env +13 -7
- arpakitlib/_arpakit_project_template_v_1/json_db/json_db.py +28 -0
- arpakitlib/_arpakit_project_template_v_1/operation_execution/operation_executor_worker.py +256 -0
- arpakitlib/_arpakit_project_template_v_1/operation_execution/scheduled_operation_creator_worker.py +106 -0
- arpakitlib/_arpakit_project_template_v_1/operation_execution/scheduled_operations.py +49 -0
- arpakitlib/_arpakit_project_template_v_1/operation_execution/util.py +29 -0
- arpakitlib/_arpakit_project_template_v_1/resource/static/openapi-favicon.png +0 -0
- arpakitlib/_arpakit_project_template_v_1/resource/static/swagger-ui/index.html +19 -0
- arpakitlib/_arpakit_project_template_v_1/resource/static/swagger-ui/swagger-ui-bundle.js +2 -0
- arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/swagger-ui-es-bundle-core.js +1 -1
- arpakitlib/_arpakit_project_template_v_1/resource/static/swagger-ui/swagger-ui-es-bundle-core.js.map +1 -0
- arpakitlib/_arpakit_project_template_v_1/resource/static/swagger-ui/swagger-ui-es-bundle.js +2 -0
- arpakitlib/_arpakit_project_template_v_1/resource/static/swagger-ui/swagger-ui-standalone-preset.js +2 -0
- arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/swagger-ui.js +1 -1
- arpakitlib/_arpakit_project_template_v_1/resource/static/swagger-ui/swagger-ui.js.map +1 -0
- arpakitlib/_arpakit_project_template_v_1/sandbox/sandbox_1.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/sandbox/sandbox_2.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/sandbox/sandbox_3.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/sandbox/sandbox_4.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/sandbox/sandbox_5.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/sandbox/sandbox_6.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/sandbox/sandbox_7.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/site/router/main_router.py +3 -0
- arpakitlib/_arpakit_project_template_v_1/sqladmin_/add_admin_in_app.py +24 -0
- arpakitlib/_arpakit_project_template_v_1/sqladmin_/admin_auth.py +54 -0
- arpakitlib/_arpakit_project_template_v_1/sqladmin_/model_view.py +95 -0
- arpakitlib/_arpakit_project_template_v_1/sqlalchemy_db/sqlalchemy_db.py +22 -0
- arpakitlib/_arpakit_project_template_v_1/sqlalchemy_db/sqlalchemy_model.py +129 -0
- arpakitlib/_arpakit_project_template_v_1/sqlalchemy_db/util.py +28 -0
- arpakitlib/{_arpakit_project_template/src/sandbox/sandbox_3.py → _arpakit_project_template_v_1/test_data/make_test_data_1.py} +8 -3
- arpakitlib/{_arpakit_project_template/src/sandbox/sandbox_4.py → _arpakit_project_template_v_1/test_data/make_test_data_2.py} +8 -3
- arpakitlib/{_arpakit_project_template/src/sandbox/sandbox_1.py → _arpakit_project_template_v_1/test_data/make_test_data_3.py} +8 -3
- arpakitlib/{_arpakit_project_template/src/sandbox/sandbox_2.py → _arpakit_project_template_v_1/test_data/make_test_data_4.py} +8 -3
- arpakitlib/_arpakit_project_template_v_1/test_data/make_test_data_5.py +22 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/blank/blank.py +5 -0
- arpakitlib/{_arpakit_project_template/src → _arpakit_project_template_v_1}/tg_bot/blank/util.py +1 -1
- arpakitlib/{_arpakit_project_template/src → _arpakit_project_template_v_1}/tg_bot/const.py +6 -3
- arpakitlib/_arpakit_project_template_v_1/tg_bot/event.py +51 -0
- arpakitlib/{_arpakit_project_template/src → _arpakit_project_template_v_1}/tg_bot/filter/not_prod_mode.py +1 -1
- arpakitlib/{_arpakit_project_template/src → _arpakit_project_template_v_1}/tg_bot/filter/prod_mode.py +1 -1
- arpakitlib/_arpakit_project_template_v_1/tg_bot/kb/static_/__init__.py +0 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/kb/static_/common.py +0 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/middleware/__init__.py +0 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/middleware/init_user.py +24 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/middleware/middleware.py +12 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/router/__init__.py +0 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/router/arpakitlib_.py +10 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/router/error.py +15 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/router/healthcheck.py +10 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/router/main_router.py +14 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/start_tg_bot.py +34 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/tg_bot.py +24 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/tg_bot_dispatcher.py +19 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/transmitted_tg_data.py +58 -0
- arpakitlib/_arpakit_project_template_v_1/tg_bot/util.py +0 -0
- arpakitlib/_arpakit_project_template_v_1/util/__init__.py +0 -0
- arpakitlib/_arpakit_project_template_v_1/util/read_arpakitlib_project_template_file.py +17 -0
- arpakitlib/ar_aiogram_util.py +41 -52
- arpakitlib/ar_arpakit_project_template_util.py +5 -11
- arpakitlib/ar_arpakitlib_cli_util.py +8 -2
- arpakitlib/ar_base_worker_util.py +35 -17
- arpakitlib/ar_class_util.py +11 -0
- arpakitlib/ar_func_util.py +19 -29
- arpakitlib/ar_http_request_util.py +10 -2
- arpakitlib/ar_rat_func_util.py +1 -1
- arpakitlib/ar_retry_func_util.py +4 -4
- arpakitlib/ar_schedule_uust_api_client_util.py +1 -1
- arpakitlib/ar_settings_util.py +3 -204
- arpakitlib/ar_sqladmin_util.py +7 -102
- arpakitlib/ar_sqlalchemy_util.py +65 -13
- arpakitlib/ar_type_util.py +0 -2
- {arpakitlib-1.7.257.dist-info → arpakitlib-1.8.1.dist-info}/METADATA +5 -3
- arpakitlib-1.8.1.dist-info/RECORD +261 -0
- {arpakitlib-1.7.257.dist-info → arpakitlib-1.8.1.dist-info}/WHEEL +1 -1
- arpakitlib/_arpakit_project_template/ARPAKITLIB +0 -1
- arpakitlib/_arpakit_project_template/manage/docker_ps.sh +0 -2
- arpakitlib/_arpakit_project_template/manage/git_branch.sh +0 -2
- arpakitlib/_arpakit_project_template/manage/poetry_add_plugin_export.sh +0 -2
- arpakitlib/_arpakit_project_template/manage/poetry_config_virtualenvs_in_project_true.sh +0 -2
- arpakitlib/_arpakit_project_template/manage/poetry_self_add_plugin_export.sh +0 -2
- arpakitlib/_arpakit_project_template/src/admin1/add_admin_in_app.py +0 -32
- arpakitlib/_arpakit_project_template/src/admin1/admin_auth.py +0 -29
- arpakitlib/_arpakit_project_template/src/admin1/model_view.py +0 -1
- arpakitlib/_arpakit_project_template/src/api/asgi.py +0 -3
- arpakitlib/_arpakit_project_template/src/api/auth.py +0 -53
- arpakitlib/_arpakit_project_template/src/api/const.py +0 -13
- arpakitlib/_arpakit_project_template/src/api/create_api_app.py +0 -43
- arpakitlib/_arpakit_project_template/src/api/create_handle_exception_.py +0 -59
- arpakitlib/_arpakit_project_template/src/api/event.py +0 -83
- arpakitlib/_arpakit_project_template/src/api/router/v1/get_api_error_info.py +0 -27
- arpakitlib/_arpakit_project_template/src/api/router/v1/main_router.py +0 -15
- arpakitlib/_arpakit_project_template/src/api/schema/v1/in_.py +0 -1
- arpakitlib/_arpakit_project_template/src/api/schema/v1/out.py +0 -1
- arpakitlib/_arpakit_project_template/src/api/transmitted_api_data.py +0 -7
- arpakitlib/_arpakit_project_template/src/api/util.py +0 -44
- arpakitlib/_arpakit_project_template/src/core/const.py +0 -41
- arpakitlib/_arpakit_project_template/src/core/settings.py +0 -21
- arpakitlib/_arpakit_project_template/src/core/util.py +0 -61
- arpakitlib/_arpakit_project_template/src/json_db/_drop_json_db.py +0 -13
- arpakitlib/_arpakit_project_template/src/json_db/_init_json_db.py +0 -11
- arpakitlib/_arpakit_project_template/src/json_db/_reinit_json_db.py +0 -13
- arpakitlib/_arpakit_project_template/src/json_db/_rm_all_records_in_json_db.py +0 -13
- arpakitlib/_arpakit_project_template/src/json_db/json_db.py +0 -11
- arpakitlib/_arpakit_project_template/src/json_db/util.py +0 -17
- arpakitlib/_arpakit_project_template/src/just_script/example.py +0 -16
- arpakitlib/_arpakit_project_template/src/operation_execution/_start_operation_executor_worker.py +0 -17
- arpakitlib/_arpakit_project_template/src/operation_execution/_start_scheduled_operation_creator_worker.py +0 -17
- arpakitlib/_arpakit_project_template/src/operation_execution/const.py +0 -9
- arpakitlib/_arpakit_project_template/src/operation_execution/operation_executor.py +0 -16
- arpakitlib/_arpakit_project_template/src/operation_execution/scheduled_operations.py +0 -29
- arpakitlib/_arpakit_project_template/src/operation_execution/util.py +0 -1
- arpakitlib/_arpakit_project_template/src/sandbox/sandbox_5.py +0 -17
- arpakitlib/_arpakit_project_template/src/sandbox/sandbox_6.py +0 -17
- arpakitlib/_arpakit_project_template/src/sandbox/sandbox_7.py +0 -17
- arpakitlib/_arpakit_project_template/src/sqlalchemy_db/_check_conn_sqlalchemy_db.py +0 -11
- arpakitlib/_arpakit_project_template/src/sqlalchemy_db/_drop_sqlalchemy_db.py +0 -13
- arpakitlib/_arpakit_project_template/src/sqlalchemy_db/_init_sqlalchemy_db.py +0 -11
- arpakitlib/_arpakit_project_template/src/sqlalchemy_db/_reinit_sqlalchemy_db.py +0 -13
- arpakitlib/_arpakit_project_template/src/sqlalchemy_db/_remove_operations.py +0 -15
- arpakitlib/_arpakit_project_template/src/sqlalchemy_db/_remove_story_logs.py +0 -16
- arpakitlib/_arpakit_project_template/src/sqlalchemy_db/sqlalchemy_model.py +0 -13
- arpakitlib/_arpakit_project_template/src/sqlalchemy_db/util.py +0 -27
- arpakitlib/_arpakit_project_template/src/test_data/make_test_data_1.py +0 -8
- arpakitlib/_arpakit_project_template/src/test_data/make_test_data_2.py +0 -8
- arpakitlib/_arpakit_project_template/src/test_data/make_test_data_3.py +0 -8
- arpakitlib/_arpakit_project_template/src/test_data/make_test_data_4.py +0 -8
- arpakitlib/_arpakit_project_template/src/test_data/make_test_data_5.py +0 -8
- arpakitlib/_arpakit_project_template/src/tg_bot/blank/blank.py +0 -10
- arpakitlib/_arpakit_project_template/src/tg_bot/event.py +0 -39
- arpakitlib/_arpakit_project_template/src/tg_bot/router/error.py +0 -3
- arpakitlib/_arpakit_project_template/src/tg_bot/router/router.py +0 -7
- arpakitlib/_arpakit_project_template/src/tg_bot/start_tg_bot.py +0 -11
- arpakitlib/_arpakit_project_template/src/tg_bot/transmitted_tg_data.py +0 -6
- arpakitlib/_arpakit_project_template/src/tg_bot/util.py +0 -44
- arpakitlib/ar_api_key_util.py +0 -21
- arpakitlib/ar_fastapi_static/swagger-ui/index.html +0 -19
- arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-bundle.js +0 -2
- arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-es-bundle-core.js.map +0 -1
- arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-es-bundle.js +0 -2
- arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-standalone-preset.js +0 -2
- arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js.map +0 -1
- arpakitlib/ar_fastapi_util.py +0 -862
- arpakitlib/ar_operation_execution_util.py +0 -504
- arpakitlib/ar_sqlalchemy_model_util.py +0 -183
- arpakitlib-1.7.257.dist-info/RECORD +0 -236
- /arpakitlib/{_arpakit_project_template → _arpakit_project_template_v_1}/.gitignore +0 -0
- /arpakitlib/{_arpakit_project_template → _arpakit_project_template_v_1}/.python-version +0 -0
- /arpakitlib/{_arpakit_project_template → _arpakit_project_template_v_1}/LICENSE +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/additional_model}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src → _arpakit_project_template_v_1}/additional_model/additional_model.py +0 -0
- /arpakitlib/{_arpakit_project_template → _arpakit_project_template_v_1}/alembic/README +0 -0
- /arpakitlib/{_arpakit_project_template → _arpakit_project_template_v_1}/alembic/script.py.mako +0 -0
- /arpakitlib/{_arpakit_project_template → _arpakit_project_template_v_1}/alembic.ini +0 -0
- /arpakitlib/{_arpakit_project_template/manage/note → _arpakit_project_template_v_1/api}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/resource → _arpakit_project_template_v_1/api/router}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/resource/static → _arpakit_project_template_v_1/api/router/v1}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src → _arpakit_project_template_v_1/api/schema}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/additional_model → _arpakit_project_template_v_1/api/schema/common}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/admin1 → _arpakit_project_template_v_1/api/schema/v1}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/manage/note/note_1.txt → _arpakit_project_template_v_1/api/util.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/api → _arpakit_project_template_v_1/business_service}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/api/router → _arpakit_project_template_v_1/celery_}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/api/router/v1 → _arpakit_project_template_v_1/command}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/alembic_upgrade_head .sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/docker_ps_a.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/docker_rm_postgres.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/docker_run_postgres.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/docker_start_postgres.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/docker_stop_postgres.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/git_commit.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/git_push_arpakit_company_github_1.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/git_push_arpakit_company_gitlab_1.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/git_push_arpakit_github_1.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/git_push_arpakit_gitlab_1.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage/git_remote_v.sh → _arpakit_project_template_v_1/command/git_remote.sh} +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/git_set_arpakit_company_origin.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/git_set_arpakit_origin.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/git_status.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/poetry_check.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/poetry_clear_cache.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/poetry_config.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/poetry_install.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/poetry_lock.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/poetry_remove_and_add_arpakitlib.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/poetry_show.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/poetry_show_arpakitlib.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/poetry_update.sh +0 -0
- /arpakitlib/{_arpakit_project_template/manage → _arpakit_project_template_v_1/command}/poetry_update_arpakitlib.sh +0 -0
- /arpakitlib/{_arpakit_project_template/src/api/schema → _arpakit_project_template_v_1/core}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/api/schema/v1 → _arpakit_project_template_v_1/json_db}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/business_service → _arpakit_project_template_v_1/note}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/manage/note/note_2.txt → _arpakit_project_template_v_1/note/note_1.txt} +0 -0
- /arpakitlib/{_arpakit_project_template/manage/note/note_3.txt → _arpakit_project_template_v_1/note/note_2.txt} +0 -0
- /arpakitlib/{_arpakit_project_template/manage/note/note_4.txt → _arpakit_project_template_v_1/note/note_3.txt} +0 -0
- /arpakitlib/{_arpakit_project_template/manage/note/note_5.txt → _arpakit_project_template_v_1/note/note_4.txt} +0 -0
- /arpakitlib/{_arpakit_project_template/src/core/__init__.py → _arpakit_project_template_v_1/note/note_5.txt} +0 -0
- /arpakitlib/{_arpakit_project_template/src/json_db → _arpakit_project_template_v_1/operation_execution}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/just_script/__init__.py → _arpakit_project_template_v_1/operation_execution/const.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/operation_execution → _arpakit_project_template_v_1/resource}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/resource/static/healthcheck → _arpakit_project_template_v_1/resource/static/1} +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/healthcheck +0 -0
- /arpakitlib/{_arpakit_project_template → _arpakit_project_template_v_1}/resource/static/helloworld +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/redoc/redoc.standalone.js +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/favicon-16x16.png +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/favicon-32x32.png +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/index.css +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/oauth2-redirect.html +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/swagger-initializer.js +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/swagger-ui-bundle.js.map +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/swagger-ui-es-bundle.js.map +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/swagger-ui-standalone-preset.js.map +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/swagger-ui.css +0 -0
- /arpakitlib/{ar_fastapi_static → _arpakit_project_template_v_1/resource/static}/swagger-ui/swagger-ui.css.map +0 -0
- /arpakitlib/{_arpakit_project_template/src → _arpakit_project_template_v_1}/sandbox/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/sqlalchemy_db → _arpakit_project_template_v_1/site}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/test_data/__init__.py → _arpakit_project_template_v_1/site/asgi.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/__init__.py → _arpakit_project_template_v_1/site/consts.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/blank/__init__.py → _arpakit_project_template_v_1/site/create_site_app.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/filter/__init__.py → _arpakit_project_template_v_1/site/event.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/handler/__init__.py → _arpakit_project_template_v_1/site/exception_handler.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/kb → _arpakit_project_template_v_1/site/router}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/kb/inline_ → _arpakit_project_template_v_1/sqladmin_}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/kb/static_ → _arpakit_project_template_v_1/sqlalchemy_db}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src → _arpakit_project_template_v_1}/sqlalchemy_db/const.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/middleware → _arpakit_project_template_v_1/test_data}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/router → _arpakit_project_template_v_1/tg_bot}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/util → _arpakit_project_template_v_1/tg_bot/blank}/__init__.py +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/handler/cmd_arpakitlib.py → _arpakit_project_template_v_1/tg_bot/filter/__init__.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/handler/cmd_healthcheck.py → _arpakit_project_template_v_1/tg_bot/kb/__init__.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/kb/inline_/callback.py → _arpakit_project_template_v_1/tg_bot/kb/inline_/__init__.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/kb/inline_/common.py → _arpakit_project_template_v_1/tg_bot/kb/inline_/callback.py} +0 -0
- /arpakitlib/{_arpakit_project_template/src/tg_bot/kb/static_ → _arpakit_project_template_v_1/tg_bot/kb/inline_}/common.py +0 -0
- {arpakitlib-1.7.257.dist-info → arpakitlib-1.8.1.dist-info}/LICENSE +0 -0
- {arpakitlib-1.7.257.dist-info → arpakitlib-1.8.1.dist-info}/entry_points.txt +0 -0
arpakitlib/ar_func_util.py
CHANGED
@@ -5,50 +5,40 @@ from typing import Callable
|
|
5
5
|
_ARPAKIT_LIB_MODULE_VERSION = "3.0"
|
6
6
|
|
7
7
|
|
8
|
-
def
|
9
|
-
|
8
|
+
def is_async_callable(obj: Callable) -> bool:
|
9
|
+
if inspect.ismethod(obj) or inspect.isfunction(obj):
|
10
|
+
return inspect.iscoroutinefunction(obj)
|
11
|
+
if isinstance(obj, (staticmethod, classmethod)):
|
12
|
+
return inspect.iscoroutinefunction(obj.__func__)
|
13
|
+
return False
|
10
14
|
|
11
15
|
|
12
|
-
def
|
13
|
-
|
16
|
+
def raise_if_not_async_callable(obj: Callable):
|
17
|
+
if not is_async_callable(obj):
|
18
|
+
raise TypeError(f"The provided callable '{obj.__name__}' is not an async")
|
14
19
|
|
15
20
|
|
16
|
-
|
17
|
-
return inspect.isfunction(func) and not is_async_function(func)
|
21
|
+
# ---
|
18
22
|
|
19
23
|
|
20
|
-
def
|
21
|
-
|
22
|
-
raise TypeError(f"The provided function '{func.__name__}' is not an async function")
|
24
|
+
def is_async_object(obj: object) -> bool:
|
25
|
+
return asyncio.iscoroutine(obj)
|
23
26
|
|
24
27
|
|
25
|
-
|
26
|
-
if not is_sync_function(func):
|
27
|
-
raise TypeError(f"The provided function '{func.__name__}' is not a sync function")
|
28
|
+
# ---
|
28
29
|
|
29
30
|
|
30
|
-
def
|
31
|
-
|
32
|
-
raise TypeError(f"The provided function '{func.__name__}' should not be async")
|
31
|
+
def is_sync_function(obj: Callable) -> bool:
|
32
|
+
return callable(obj) and not is_async_callable(obj=obj)
|
33
33
|
|
34
34
|
|
35
|
-
def
|
36
|
-
if is_sync_function(
|
37
|
-
raise TypeError(f"The provided
|
35
|
+
def raise_if_not_sync_callable(obj: Callable):
|
36
|
+
if not is_sync_function(obj):
|
37
|
+
raise TypeError(f"The provided callable '{obj.__name__}' is not an sync")
|
38
38
|
|
39
39
|
|
40
40
|
def __example():
|
41
|
-
|
42
|
-
pass
|
43
|
-
|
44
|
-
async def two():
|
45
|
-
pass
|
46
|
-
|
47
|
-
print(is_sync_function(one))
|
48
|
-
print(is_sync_function(two))
|
49
|
-
|
50
|
-
print(is_async_function(one))
|
51
|
-
print(is_async_function(two))
|
41
|
+
pass
|
52
42
|
|
53
43
|
|
54
44
|
if __name__ == '__main__':
|
@@ -29,6 +29,7 @@ def sync_make_http_request(
|
|
29
29
|
not_raise_for_statuses_: list[int] | None = None,
|
30
30
|
timeout_: timedelta | float = timedelta(seconds=15).total_seconds(),
|
31
31
|
enable_logging_: bool = False,
|
32
|
+
exception_class_: type[Exception] | None = None,
|
32
33
|
**kwargs
|
33
34
|
) -> requests.Response:
|
34
35
|
if isinstance(timeout_, float):
|
@@ -75,7 +76,10 @@ def sync_make_http_request(
|
|
75
76
|
f"{tries_counter}/{max_tries_}, bad try {method} {url} {params}, exception={exception}"
|
76
77
|
)
|
77
78
|
if tries_counter >= max_tries_:
|
78
|
-
|
79
|
+
if exception_class_ is not None:
|
80
|
+
raise exception_class_(exception)
|
81
|
+
else:
|
82
|
+
raise exception
|
79
83
|
sync_safe_sleep(timedelta(seconds=0.1).total_seconds())
|
80
84
|
continue
|
81
85
|
|
@@ -92,6 +96,7 @@ async def async_make_http_request(
|
|
92
96
|
not_raise_for_statuses_: list[int] | None = None,
|
93
97
|
timeout_: timedelta | None = timedelta(seconds=15),
|
94
98
|
enable_logging_: bool = False,
|
99
|
+
exception_class_: type[Exception] | None = None,
|
95
100
|
**kwargs
|
96
101
|
) -> aiohttp.ClientResponse:
|
97
102
|
tries_counter = 0
|
@@ -137,7 +142,10 @@ async def async_make_http_request(
|
|
137
142
|
f"{tries_counter}/{max_tries_}, bad try {method} {url} {params}, exception={exception}"
|
138
143
|
)
|
139
144
|
if tries_counter >= max_tries_:
|
140
|
-
|
145
|
+
if exception_class_ is not None:
|
146
|
+
raise exception_class_(exception)
|
147
|
+
else:
|
148
|
+
raise exception
|
141
149
|
await async_safe_sleep(timedelta(seconds=0.1).total_seconds())
|
142
150
|
continue
|
143
151
|
|
arpakitlib/ar_rat_func_util.py
CHANGED
arpakitlib/ar_retry_func_util.py
CHANGED
@@ -27,11 +27,11 @@ async def async_retry_func(
|
|
27
27
|
while True:
|
28
28
|
try:
|
29
29
|
return await async_func(*async_func_args, **async_func_kwargs)
|
30
|
-
except Exception:
|
30
|
+
except Exception as exception:
|
31
31
|
tries += 1
|
32
32
|
if not endlessly and tries >= max_tries:
|
33
33
|
if raise_if_exception:
|
34
|
-
raise
|
34
|
+
raise exception
|
35
35
|
return None
|
36
36
|
if timeout_after_exception:
|
37
37
|
await async_safe_sleep(timeout_after_exception.total_seconds())
|
@@ -54,11 +54,11 @@ def sync_retry_func(
|
|
54
54
|
while True:
|
55
55
|
try:
|
56
56
|
return sync_func(*sync_func_args, **sync_func_kwargs)
|
57
|
-
except Exception:
|
57
|
+
except Exception as exception:
|
58
58
|
tries += 1
|
59
59
|
if not endlessly and tries >= max_tries:
|
60
60
|
if raise_if_exception:
|
61
|
-
raise
|
61
|
+
raise exception
|
62
62
|
return None
|
63
63
|
if timeout_after_exception:
|
64
64
|
sync_safe_sleep(timeout_after_exception.total_seconds())
|
arpakitlib/ar_settings_util.py
CHANGED
@@ -1,17 +1,10 @@
|
|
1
1
|
# arpakit
|
2
|
-
import os
|
3
2
|
from typing import Union, Any
|
4
3
|
|
5
|
-
import
|
6
|
-
from pydantic import ConfigDict, field_validator, model_validator
|
4
|
+
from pydantic import ConfigDict, model_validator
|
7
5
|
from pydantic_core import PydanticUndefined
|
8
|
-
from pydantic_core.core_schema import ValidationInfo
|
9
6
|
from pydantic_settings import BaseSettings
|
10
7
|
|
11
|
-
from arpakitlib.ar_enumeration_util import Enumeration
|
12
|
-
from arpakitlib.ar_json_util import safely_transfer_obj_to_json_str
|
13
|
-
from arpakitlib.ar_sqlalchemy_util import generate_sqlalchemy_url
|
14
|
-
|
15
8
|
_ARPAKIT_LIB_MODULE_VERSION = "3.0"
|
16
9
|
|
17
10
|
|
@@ -25,12 +18,7 @@ def generate_env_example(settings_class: Union[BaseSettings, type[BaseSettings]]
|
|
25
18
|
return res
|
26
19
|
|
27
20
|
|
28
|
-
class
|
29
|
-
not_prod: str = "not_prod"
|
30
|
-
prod: str = "prod"
|
31
|
-
|
32
|
-
|
33
|
-
class BaseSettings2(BaseSettings):
|
21
|
+
class SimpleSettings(BaseSettings):
|
34
22
|
model_config = ConfigDict(extra="ignore")
|
35
23
|
|
36
24
|
@model_validator(mode="before")
|
@@ -53,197 +41,8 @@ class BaseSettings2(BaseSettings):
|
|
53
41
|
return env_example
|
54
42
|
|
55
43
|
|
56
|
-
class SimpleSettings(BaseSettings2):
|
57
|
-
mode_type: str = ModeTypes.not_prod
|
58
|
-
|
59
|
-
@field_validator("mode_type")
|
60
|
-
@classmethod
|
61
|
-
def validate_mode_type(cls, v: str):
|
62
|
-
ModeTypes.parse_and_validate_values(v.lower().strip())
|
63
|
-
return v
|
64
|
-
|
65
|
-
@property
|
66
|
-
def is_mode_type_not_prod(self) -> bool:
|
67
|
-
return self.mode_type == ModeTypes.not_prod
|
68
|
-
|
69
|
-
def raise_if_mode_type_not_prod(self):
|
70
|
-
if self.is_mode_type_not_prod:
|
71
|
-
raise ValueError(f"mode type = {self.mode_type}")
|
72
|
-
|
73
|
-
@property
|
74
|
-
def is_mode_type_prod(self) -> bool:
|
75
|
-
return self.mode_type == ModeTypes.prod
|
76
|
-
|
77
|
-
def raise_if_mode_type_prod(self):
|
78
|
-
if self.is_mode_type_prod:
|
79
|
-
raise ValueError(f"mode type = {self.mode_type}")
|
80
|
-
|
81
|
-
|
82
|
-
class AdvancedSettings(SimpleSettings):
|
83
|
-
project_name: str | None = None
|
84
|
-
|
85
|
-
@field_validator("project_name", mode="after")
|
86
|
-
def validate_project_name(cls, v: Any, validation_info: ValidationInfo, **kwargs) -> str | None:
|
87
|
-
if isinstance(v, str):
|
88
|
-
return v.strip()
|
89
|
-
return v
|
90
|
-
|
91
|
-
sqlalchemy_db_user: str | None = None
|
92
|
-
|
93
|
-
sqlalchemy_db_password: str | None = None
|
94
|
-
|
95
|
-
sqlalchemy_db_host: str | None = None
|
96
|
-
|
97
|
-
sqlalchemy_db_port: int | None = None
|
98
|
-
|
99
|
-
sqlalchemy_db_database: str | None = None
|
100
|
-
|
101
|
-
sqlalchemy_sync_db_url: str | None = None
|
102
|
-
|
103
|
-
@field_validator("sqlalchemy_sync_db_url", mode="after")
|
104
|
-
def validate_sqlalchemy_sync_db_url(cls, v: Any, validation_info: ValidationInfo, **kwargs) -> str | None:
|
105
|
-
if v is not None:
|
106
|
-
return v
|
107
|
-
|
108
|
-
return generate_sqlalchemy_url(
|
109
|
-
base="postgresql",
|
110
|
-
user=validation_info.data.get("sqlalchemy_db_user"),
|
111
|
-
password=validation_info.data.get("sqlalchemy_db_password"),
|
112
|
-
host=validation_info.data.get("sqlalchemy_db_host"),
|
113
|
-
port=validation_info.data.get("sqlalchemy_db_port"),
|
114
|
-
database=validation_info.data.get("sqlalchemy_db_database")
|
115
|
-
)
|
116
|
-
|
117
|
-
sqlalchemy_async_db_url: str | None = None
|
118
|
-
|
119
|
-
@field_validator("sqlalchemy_async_db_url", mode="after")
|
120
|
-
def validate_sqlalchemy_async_db_url(cls, v: Any, validation_info: ValidationInfo, **kwargs) -> str | None:
|
121
|
-
if v is not None:
|
122
|
-
return v
|
123
|
-
|
124
|
-
return generate_sqlalchemy_url(
|
125
|
-
base="postgresql",
|
126
|
-
user=validation_info.data.get("sqlalchemy_db_user"),
|
127
|
-
password=validation_info.data.get("sqlalchemy_db_password"),
|
128
|
-
host=validation_info.data.get("sqlalchemy_db_host"),
|
129
|
-
port=validation_info.data.get("sqlalchemy_db_port"),
|
130
|
-
database=validation_info.data.get("sqlalchemy_db_database")
|
131
|
-
)
|
132
|
-
|
133
|
-
@property
|
134
|
-
def is_any_sql_db_url_set(self) -> bool:
|
135
|
-
if self.sqlalchemy_sync_db_url is not None:
|
136
|
-
return True
|
137
|
-
if self.sqlalchemy_async_db_url is not None:
|
138
|
-
return True
|
139
|
-
return False
|
140
|
-
|
141
|
-
sqlalchemy_db_echo: bool = False
|
142
|
-
|
143
|
-
api_port: int | None = None
|
144
|
-
|
145
|
-
@field_validator("api_port", mode="before")
|
146
|
-
def validate_api_port(cls, v: Any, validation_info: ValidationInfo, **kwargs) -> int | None:
|
147
|
-
if isinstance(v, str):
|
148
|
-
if v.isdigit():
|
149
|
-
return int(v)
|
150
|
-
return None
|
151
|
-
|
152
|
-
api_init_sqlalchemy_db: bool = False
|
153
|
-
|
154
|
-
api_init_json_db: bool = False
|
155
|
-
|
156
|
-
api_logging__api_func_before_in_handle_exception: bool = True
|
157
|
-
|
158
|
-
api_story_log__api_func_before_in_handle_exception: bool = False
|
159
|
-
|
160
|
-
api_correct_api_key: str | None = "test"
|
161
|
-
|
162
|
-
api_correct_token: str | None = "test"
|
163
|
-
|
164
|
-
api_enable_admin1: bool = False
|
165
|
-
|
166
|
-
api_start_operation_executor_worker: bool = False
|
167
|
-
|
168
|
-
api_start_scheduled_operation_creator_worker: bool = False
|
169
|
-
|
170
|
-
admin1_secret_key: str | None = "85a9583cb91c4de7a78d7eb1e5306a04418c9c43014c447ea8ec8dd5deb4cf71"
|
171
|
-
|
172
|
-
tg_bot_token: str | None = None
|
173
|
-
|
174
|
-
tg_bot_proxy_url: str | None = None
|
175
|
-
|
176
|
-
tg_bot_init_sqlalchemy_db: bool = False
|
177
|
-
|
178
|
-
tg_bot_init_json_db: bool = False
|
179
|
-
|
180
|
-
var_dirpath: str | None = None
|
181
|
-
|
182
|
-
log_filepath: str | None = None
|
183
|
-
|
184
|
-
@field_validator("log_filepath", mode="after")
|
185
|
-
def validate_log_filepath(cls, v: Any, validation_info: ValidationInfo, **kwargs) -> str | None:
|
186
|
-
if v is not None:
|
187
|
-
return v
|
188
|
-
var_dirpath = validation_info.data.get("var_dirpath")
|
189
|
-
if var_dirpath is None:
|
190
|
-
return None
|
191
|
-
return os.path.join(var_dirpath, "story.log")
|
192
|
-
|
193
|
-
cache_dirpath: str | None = None
|
194
|
-
|
195
|
-
@field_validator("cache_dirpath", mode="after")
|
196
|
-
def validate_cache_dirpath(cls, v: Any, validation_info: ValidationInfo, **kwargs) -> str | None:
|
197
|
-
if v is not None:
|
198
|
-
return v
|
199
|
-
var_dirpath = validation_info.data.get("var_dirpath")
|
200
|
-
if var_dirpath is None:
|
201
|
-
return None
|
202
|
-
return os.path.join(var_dirpath, "cache")
|
203
|
-
|
204
|
-
media_dirpath: str | None = None
|
205
|
-
|
206
|
-
@field_validator("media_dirpath", mode="after")
|
207
|
-
def validate_media_dirpath(cls, v: Any, validation_info: ValidationInfo, **kwargs) -> str | None:
|
208
|
-
if v is not None:
|
209
|
-
return v
|
210
|
-
var_dirpath = validation_info.data.get("var_dirpath")
|
211
|
-
if var_dirpath is None:
|
212
|
-
return None
|
213
|
-
return os.path.join(var_dirpath, "media")
|
214
|
-
|
215
|
-
dump_dirpath: str | None = None
|
216
|
-
|
217
|
-
@field_validator("dump_dirpath", mode="after")
|
218
|
-
def validate_dump_dirpath(cls, v: Any, validation_info: ValidationInfo, **kwargs) -> str | None:
|
219
|
-
if v is not None:
|
220
|
-
return v
|
221
|
-
var_dirpath = validation_info.data.get("var_dirpath")
|
222
|
-
if var_dirpath is None:
|
223
|
-
return None
|
224
|
-
return os.path.join(var_dirpath, "dump")
|
225
|
-
|
226
|
-
local_timezone: str | None = None
|
227
|
-
|
228
|
-
@property
|
229
|
-
def local_timezone_as_pytz(self) -> Any:
|
230
|
-
return pytz.timezone(self.local_timezone)
|
231
|
-
|
232
|
-
json_db_dirpath: str | None = None
|
233
|
-
|
234
|
-
@field_validator("json_db_dirpath", mode="after")
|
235
|
-
def validate_json_db_dirpath(cls, v: Any, validation_info: ValidationInfo, **kwargs) -> str | None:
|
236
|
-
if v is not None:
|
237
|
-
return v
|
238
|
-
var_dirpath = validation_info.data.get("var_dirpath")
|
239
|
-
if var_dirpath is None:
|
240
|
-
return None
|
241
|
-
project_name = validation_info.data.get("project_name")
|
242
|
-
return os.path.join(var_dirpath, f"{project_name}_json_db")
|
243
|
-
|
244
|
-
|
245
44
|
def __example():
|
246
|
-
|
45
|
+
pass
|
247
46
|
|
248
47
|
|
249
48
|
if __name__ == '__main__':
|
arpakitlib/ar_sqladmin_util.py
CHANGED
@@ -1,105 +1,10 @@
|
|
1
|
-
|
2
|
-
from sqladmin import ModelView
|
3
|
-
from sqladmin.models import ModelViewMeta
|
4
|
-
|
5
|
-
from arpakitlib.ar_class_util import CollectingSubclassesMeta
|
6
|
-
from arpakitlib.ar_sqlalchemy_model_util import OperationDBM, StoryLogDBM
|
7
|
-
|
8
|
-
_ARPAKIT_LIB_MODULE_VERSION = "3.0"
|
9
|
-
|
10
|
-
|
11
|
-
def create_combined_meta(*metas):
|
12
|
-
"""
|
13
|
-
Создает объединённый метакласс для устранения конфликтов.
|
14
|
-
"""
|
15
|
-
|
16
|
-
class CombinedMeta(*metas):
|
17
|
-
pass
|
18
|
-
|
19
|
-
return CombinedMeta
|
20
|
-
|
1
|
+
from __future__ import annotations
|
21
2
|
|
22
|
-
|
23
|
-
can_create = True
|
24
|
-
can_edit = True
|
25
|
-
can_delete = True
|
26
|
-
can_view_details = True
|
27
|
-
can_export = True
|
28
|
-
page_size = 50
|
29
|
-
page_size_options = [25, 50, 100, 200]
|
30
|
-
save_as = True
|
31
|
-
save_as_continue = True
|
32
|
-
export_types = ["xlsx", "csv", "json"]
|
33
|
-
|
34
|
-
|
35
|
-
class OperationMV(SimpleModelView, model=OperationDBM):
|
36
|
-
name = "Operation"
|
37
|
-
name_plural = "Operations"
|
38
|
-
column_list = [
|
39
|
-
OperationDBM.id,
|
40
|
-
OperationDBM.long_id,
|
41
|
-
OperationDBM.creation_dt,
|
42
|
-
OperationDBM.status,
|
43
|
-
OperationDBM.type,
|
44
|
-
OperationDBM.execution_start_dt,
|
45
|
-
OperationDBM.execution_finish_dt,
|
46
|
-
OperationDBM.input_data,
|
47
|
-
OperationDBM.output_data,
|
48
|
-
OperationDBM.error_data
|
49
|
-
]
|
50
|
-
form_columns = [
|
51
|
-
OperationDBM.status,
|
52
|
-
OperationDBM.type,
|
53
|
-
OperationDBM.execution_start_dt,
|
54
|
-
OperationDBM.execution_finish_dt,
|
55
|
-
OperationDBM.input_data,
|
56
|
-
OperationDBM.output_data,
|
57
|
-
OperationDBM.error_data
|
58
|
-
]
|
59
|
-
column_default_sort = [
|
60
|
-
(OperationDBM.creation_dt, True)
|
61
|
-
]
|
62
|
-
column_searchable_list = [
|
63
|
-
OperationDBM.id,
|
64
|
-
OperationDBM.long_id,
|
65
|
-
OperationDBM.status,
|
66
|
-
OperationDBM.type,
|
67
|
-
]
|
68
|
-
|
69
|
-
|
70
|
-
class StoryLogMV(SimpleModelView, model=StoryLogDBM):
|
71
|
-
name = "StoryLog"
|
72
|
-
name_plural = "StoryLogs"
|
73
|
-
column_list = [
|
74
|
-
StoryLogDBM.id,
|
75
|
-
StoryLogDBM.long_id,
|
76
|
-
StoryLogDBM.creation_dt,
|
77
|
-
StoryLogDBM.level,
|
78
|
-
StoryLogDBM.title,
|
79
|
-
StoryLogDBM.data
|
80
|
-
]
|
81
|
-
form_columns = [
|
82
|
-
StoryLogDBM.level,
|
83
|
-
StoryLogDBM.title,
|
84
|
-
StoryLogDBM.data
|
85
|
-
]
|
86
|
-
column_default_sort = [
|
87
|
-
(StoryLogDBM.creation_dt, True)
|
88
|
-
]
|
89
|
-
column_searchable_list = [
|
90
|
-
StoryLogDBM.id,
|
91
|
-
StoryLogDBM.long_id,
|
92
|
-
StoryLogDBM.level,
|
93
|
-
StoryLogDBM.title,
|
94
|
-
StoryLogDBM.data
|
95
|
-
]
|
96
|
-
|
97
|
-
|
98
|
-
def __example():
|
99
|
-
print(len(SimpleModelView.all_subclasses))
|
100
|
-
for model_view in SimpleModelView.all_subclasses:
|
101
|
-
print(model_view)
|
3
|
+
from sqladmin import ModelView
|
102
4
|
|
103
5
|
|
104
|
-
|
105
|
-
|
6
|
+
def get_string_info_from_model_view(class_: type[ModelView]):
|
7
|
+
res = f"Model Views: {len(class_.__subclasses__())}"
|
8
|
+
for i, cls in enumerate(class_.__subclasses__()):
|
9
|
+
res += f"\n{i + 1}. {cls.__name__}"
|
10
|
+
return res
|
arpakitlib/ar_sqlalchemy_util.py
CHANGED
@@ -12,18 +12,11 @@ from sqlalchemy.orm import sessionmaker, DeclarativeBase
|
|
12
12
|
from sqlalchemy.orm.session import Session
|
13
13
|
|
14
14
|
from arpakitlib.ar_datetime_util import now_utc_dt
|
15
|
-
from arpakitlib.
|
15
|
+
from arpakitlib.ar_json_util import safely_transfer_obj_to_json_str
|
16
16
|
|
17
17
|
_ARPAKIT_LIB_MODULE_VERSION = "3.0"
|
18
18
|
|
19
19
|
|
20
|
-
def get_string_info_from_declarative_base(class_: type[DeclarativeBase]):
|
21
|
-
res = f"Models: {len(class_.__subclasses__())}"
|
22
|
-
for i, cls in enumerate(class_.__subclasses__()):
|
23
|
-
res += f"\n{i + 1}. {cls.__name__}"
|
24
|
-
return res
|
25
|
-
|
26
|
-
|
27
20
|
def generate_sqlalchemy_url(
|
28
21
|
*,
|
29
22
|
base: str = "postgresql",
|
@@ -62,6 +55,57 @@ def generate_sqlalchemy_url(
|
|
62
55
|
return f"{base}://{auth_part}{host_part}{database_part}{query_part}"
|
63
56
|
|
64
57
|
|
58
|
+
class BaseDBM(DeclarativeBase):
|
59
|
+
__abstract__ = True
|
60
|
+
_bus_data: dict[str, Any] | None = None
|
61
|
+
|
62
|
+
@property
|
63
|
+
def bus_data(self) -> dict[str, Any]:
|
64
|
+
if self._bus_data is None:
|
65
|
+
self._bus_data = {}
|
66
|
+
return self._bus_data
|
67
|
+
|
68
|
+
def simple_dict(self, *, include_sd_properties: bool = True) -> dict[str, Any]:
|
69
|
+
res = {}
|
70
|
+
|
71
|
+
for c in inspect(self).mapper.column_attrs:
|
72
|
+
value = getattr(self, c.key)
|
73
|
+
if isinstance(value, BaseDBM):
|
74
|
+
res[c.key] = value.simple_dict(include_sd_properties=include_sd_properties)
|
75
|
+
elif isinstance(value, list):
|
76
|
+
res[c.key] = [
|
77
|
+
item.simple_dict(include_sd_properties=include_sd_properties)
|
78
|
+
if isinstance(item, BaseDBM) else item
|
79
|
+
for item in value
|
80
|
+
]
|
81
|
+
else:
|
82
|
+
res[c.key] = value
|
83
|
+
|
84
|
+
if include_sd_properties:
|
85
|
+
for attr_name in dir(self):
|
86
|
+
if attr_name.startswith("sdp_") and isinstance(getattr(type(self), attr_name, None), property):
|
87
|
+
prop_name = attr_name.removeprefix("sdp_")
|
88
|
+
value = getattr(self, attr_name)
|
89
|
+
if isinstance(value, BaseDBM):
|
90
|
+
res[prop_name] = value.simple_dict(include_sd_properties=include_sd_properties)
|
91
|
+
elif isinstance(value, list):
|
92
|
+
res[prop_name] = [
|
93
|
+
item.simple_dict(include_sd_properties=include_sd_properties)
|
94
|
+
if isinstance(item, BaseDBM) else item
|
95
|
+
for item in value
|
96
|
+
]
|
97
|
+
else:
|
98
|
+
res[prop_name] = value
|
99
|
+
|
100
|
+
return res
|
101
|
+
|
102
|
+
def simple_dict_with_sd_properties(self) -> dict[str, Any]:
|
103
|
+
return self.simple_dict(include_sd_properties=True)
|
104
|
+
|
105
|
+
def simple_json(self, *, include_sd_properties: bool = True) -> str:
|
106
|
+
return safely_transfer_obj_to_json_str(self.simple_dict(include_sd_properties=include_sd_properties))
|
107
|
+
|
108
|
+
|
65
109
|
class SQLAlchemyDb:
|
66
110
|
def __init__(
|
67
111
|
self,
|
@@ -72,7 +116,7 @@ class SQLAlchemyDb:
|
|
72
116
|
base_dbm: type[BaseDBM] | None = None,
|
73
117
|
db_models: list[Any] | None = None,
|
74
118
|
):
|
75
|
-
self._logger = logging.getLogger()
|
119
|
+
self._logger = logging.getLogger(self.__class__.__name__)
|
76
120
|
|
77
121
|
self.db_url = sync_db_url
|
78
122
|
if self.db_url is not None:
|
@@ -101,6 +145,7 @@ class SQLAlchemyDb:
|
|
101
145
|
self.func_new_async_session_counter = 0
|
102
146
|
|
103
147
|
self.base_dbm = base_dbm
|
148
|
+
self.db_models = db_models
|
104
149
|
|
105
150
|
def is_table_exists(self, table_name: str) -> bool:
|
106
151
|
with self.engine.connect() as connection:
|
@@ -112,7 +157,7 @@ class SQLAlchemyDb:
|
|
112
157
|
connection.execute(text("DROP TABLE IF EXISTS celery_tasksetmeta CASCADE;"))
|
113
158
|
connection.execute(text("DROP TABLE IF EXISTS celery_taskmeta CASCADE;"))
|
114
159
|
connection.commit()
|
115
|
-
|
160
|
+
self._logger.info("celery tables were dropped")
|
116
161
|
|
117
162
|
def remove_celery_tables_data(self):
|
118
163
|
if not self.is_table_exists("celery_tasksetmeta"):
|
@@ -122,14 +167,14 @@ class SQLAlchemyDb:
|
|
122
167
|
connection.execute(text("DELETE FROM celery_tasksetmeta;"))
|
123
168
|
connection.execute(text("DELETE FROM celery_taskmeta;"))
|
124
169
|
connection.commit()
|
125
|
-
|
170
|
+
self._logger.info("celery tables data were removed")
|
126
171
|
|
127
172
|
def drop_alembic_tables(self):
|
128
173
|
with self.engine.connect() as connection:
|
129
174
|
connection.execute(text("DROP TABLE IF EXISTS alembic_version CASCADE;"))
|
130
175
|
connection.execute(text("DROP TABLE IF EXISTS alembic_version CASCADE;"))
|
131
176
|
connection.commit()
|
132
|
-
|
177
|
+
self._logger.info("alembic_version tables were dropped")
|
133
178
|
|
134
179
|
def remove_alembic_tables_data(self):
|
135
180
|
if not self.is_table_exists("alembic_version"):
|
@@ -138,7 +183,7 @@ class SQLAlchemyDb:
|
|
138
183
|
with self.engine.connect() as connection:
|
139
184
|
connection.execute(text("DELETE FROM alembic_version;"))
|
140
185
|
connection.commit()
|
141
|
-
|
186
|
+
self._logger.info("alembic tables data were removed")
|
142
187
|
|
143
188
|
def init(self):
|
144
189
|
self.base_dbm.metadata.create_all(bind=self.engine, checkfirst=True)
|
@@ -191,6 +236,13 @@ class SQLAlchemyDb:
|
|
191
236
|
return now_utc_dt()
|
192
237
|
|
193
238
|
|
239
|
+
def get_string_info_from_declarative_base(class_: type[DeclarativeBase]):
|
240
|
+
res = f"Db Models: {len(class_.__subclasses__())}"
|
241
|
+
for i, cls in enumerate(class_.__subclasses__()):
|
242
|
+
res += f"\n{i + 1}. {cls.__name__}"
|
243
|
+
return res
|
244
|
+
|
245
|
+
|
194
246
|
def __example():
|
195
247
|
pass
|
196
248
|
|
arpakitlib/ar_type_util.py
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: arpakitlib
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.8.1
|
4
4
|
Summary: arpakitlib
|
5
5
|
License: Apache-2.0
|
6
6
|
Keywords: arpakitlib,arpakit,arpakit-company,arpakitcompany,arpakit_company
|
7
|
-
Author:
|
8
|
-
Author-email: arpakit
|
7
|
+
Author: arpakit_support
|
8
|
+
Author-email: support@arpakit.com
|
9
9
|
Requires-Python: >=3.12.4,<4.0
|
10
10
|
Classifier: Development Status :: 5 - Production/Stable
|
11
11
|
Classifier: Intended Audience :: Developers
|
@@ -55,6 +55,7 @@ Requires-Dist: uvicorn (>=0.34.0,<0.35.0)
|
|
55
55
|
Project-URL: Documentation, https://github.com/ARPAKIT-Company/arpakitlib
|
56
56
|
Project-URL: Homepage, https://github.com/ARPAKIT-Company/arpakitlib
|
57
57
|
Project-URL: Repository, https://github.com/ARPAKIT-Company/arpakitlib
|
58
|
+
Project-URL: arpakit_company_site, https://arpakit.com/
|
58
59
|
Project-URL: telegram_channel, https://t.me/arpakitlib
|
59
60
|
Description-Content-Type: text/markdown
|
60
61
|
|
@@ -89,6 +90,7 @@ pip install arpakitlib
|
|
89
90
|
|
90
91
|
```
|
91
92
|
poetry run arpakitlib -c help
|
93
|
+
poetry run arpakitlib -c init_arpakit_project_template -version 1 -project_dirpath ./ -overwrite_if_exists True
|
92
94
|
```
|
93
95
|
|
94
96
|
---
|