arpakitlib 1.6.72__tar.gz → 1.6.75__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.
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/PKG-INFO +1 -1
- arpakitlib-1.6.75/arpakitlib/_ar_arpakitlib_cli.py +52 -0
- arpakitlib-1.6.75/arpakitlib/_arpakit_project_template/src/util/__init__.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_parse_command.py +4 -2
- arpakitlib-1.6.75/arpakitlib/ar_project_template_util.py +62 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_str_util.py +8 -2
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/pyproject.toml +1 -1
- arpakitlib-1.6.72/arpakitlib/_ar_arpakitlib_cli.py +0 -51
- arpakitlib-1.6.72/arpakitlib/ar_project_template_util.py +0 -55
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/LICENSE +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/NOTICE +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/README.md +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/__init__.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/.env_example +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/.gitignore +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/.python-version +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/AUTHOR.md +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/LICENSE +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/NOTICE +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/README.md +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/__init__.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/beutify_json.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/docker_ps.sh +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/generate_env_example.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/git_commit.sh +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/git_push_dev_arpakit_company_github_1.sh +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/git_push_dev_arpakit_company_gitlab_1.sh +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/git_remote_v.sh +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/git_set_arpakit_company_origin.sh +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/git_status.sh +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/hello_world.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/poetry_add_plugin_export.sh +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/poetry_check.sh +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/poetry_clear_cache.sh +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/poetry_config_virtualenvs.in-project_true.sh +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/poetry_generate_requirements.txt.sh +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/poetry_install.sh +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/poetry_lock.sh +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/poetry_remove_and_add_arpakitlib.sh +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/poetry_show.sh +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/poetry_update.sh +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/poetry_update_arpakitlib.sh +0 -0
- {arpakitlib-1.6.72/arpakitlib/_arpakit_project_template/resource → arpakitlib-1.6.75/arpakitlib/_arpakit_project_template/manage/src}/__init__.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/pyproject.toml +0 -0
- {arpakitlib-1.6.72/arpakitlib/_arpakit_project_template/src → arpakitlib-1.6.75/arpakitlib/_arpakit_project_template/resource}/__init__.py +0 -0
- {arpakitlib-1.6.72/arpakitlib/_arpakit_project_template/src/additional_model → arpakitlib-1.6.75/arpakitlib/_arpakit_project_template/src}/__init__.py +0 -0
- {arpakitlib-1.6.72/arpakitlib/_arpakit_project_template/src/business_service → arpakitlib-1.6.75/arpakitlib/_arpakit_project_template/src/additional_model}/__init__.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/src/additional_model/additional_model.py +0 -0
- {arpakitlib-1.6.72/arpakitlib/_arpakit_project_template/src/core → arpakitlib-1.6.75/arpakitlib/_arpakit_project_template/src/business_service}/__init__.py +0 -0
- {arpakitlib-1.6.72/arpakitlib/_arpakit_project_template/src/util → arpakitlib-1.6.75/arpakitlib/_arpakit_project_template/src/core}/__init__.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/src/core/const.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/src/core/settings.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/src/core/util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_additional_model_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_aiogram_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_arpakit_lib_module_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_arpakit_schedule_uust_api_client_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_base64_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_base_worker_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_cache_file_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_datetime_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_dict_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_dream_ai_api_client_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_encrypt_decrypt_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_enumeration_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/redoc/redoc.standalone.js +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/favicon-16x16.png +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/favicon-32x32.png +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/index.css +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/index.html +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/oauth2-redirect.html +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-initializer.js +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-bundle.js +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-bundle.js.map +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-es-bundle-core.js +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-es-bundle-core.js.map +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-es-bundle.js +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-es-bundle.js.map +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-standalone-preset.js +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-standalone-preset.js.map +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.css +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.css.map +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js.map +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_file_storage_in_dir_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_file_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_hash_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_hello_world.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_http_request_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_ip_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_json_db_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_json_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_jwt_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_list_of_dicts_to_xlsx.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_list_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_logging_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_mongodb_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_need_type_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_openai_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_operation_execution_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_postgresql_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_run_cmd_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_schedule_uust_api_client_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_settings_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_sleep_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_sqlalchemy_model_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_sqlalchemy_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_ssh_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_type_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_yookassa_api_client_util.py +0 -0
- {arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_zabbix_util.py +0 -0
@@ -0,0 +1,52 @@
|
|
1
|
+
# arpakit
|
2
|
+
|
3
|
+
import sys
|
4
|
+
|
5
|
+
from arpakitlib.ar_need_type_util import parse_need_type, NeedTypes
|
6
|
+
from arpakitlib.ar_parse_command import parse_command
|
7
|
+
from arpakitlib.ar_project_template_util import init_arpakit_project_template
|
8
|
+
from arpakitlib.ar_str_util import raise_if_blank
|
9
|
+
|
10
|
+
|
11
|
+
def _arpakitlib_cli(*, full_command: str | None = None):
|
12
|
+
if full_command is None:
|
13
|
+
full_command = " ".join(sys.argv)
|
14
|
+
|
15
|
+
parsed_command = parse_command(text=full_command)
|
16
|
+
parsed_command.raise_for_command(needed_command="arpakitlib", lower_=True)
|
17
|
+
|
18
|
+
command = parsed_command.get_value_by_keys(keys=["command", "c"])
|
19
|
+
if command:
|
20
|
+
command = command.strip()
|
21
|
+
if not command:
|
22
|
+
raise Exception(f"not command, command={command}")
|
23
|
+
|
24
|
+
if command == "help":
|
25
|
+
print(
|
26
|
+
"Commands:"
|
27
|
+
"\n- init_arpakit_project_template"
|
28
|
+
" (project_dirpath, remove_if_exists, project_name, ignore_src_dir, ignore_manage_dir)"
|
29
|
+
)
|
30
|
+
|
31
|
+
elif command == "init_arpakit_project_template":
|
32
|
+
project_dirpath = raise_if_blank(parsed_command.get_value_by_keys(keys=["pd", "project_dirpath"]))
|
33
|
+
overwrite_if_exists: bool = parse_need_type(
|
34
|
+
value=parsed_command.get_value_by_keys(keys=["oie", "overwrite_if_exists"]),
|
35
|
+
need_type=NeedTypes.bool_
|
36
|
+
)
|
37
|
+
project_name: str = parsed_command.get_value_by_keys(keys=["pm", "project_name"])
|
38
|
+
ignore_paths_startswith: list[str] | None = parse_need_type(
|
39
|
+
value=parsed_command.get_value_by_keys(keys=["ipsw", "ignore_paths_startswith"]),
|
40
|
+
need_type=NeedTypes.list_of_str
|
41
|
+
)
|
42
|
+
init_arpakit_project_template(
|
43
|
+
project_dirpath=project_dirpath, overwrite_if_exists=overwrite_if_exists, project_name=project_name,
|
44
|
+
ignore_paths_startswith=ignore_paths_startswith
|
45
|
+
)
|
46
|
+
|
47
|
+
else:
|
48
|
+
raise Exception(f"not recognized command, command={command}")
|
49
|
+
|
50
|
+
|
51
|
+
if __name__ == '__main__':
|
52
|
+
_arpakitlib_cli(full_command="/arpakitlib -c help")
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# arpakit
|
2
|
-
|
2
|
+
import os
|
3
3
|
import shlex
|
4
4
|
|
5
5
|
from pydantic import BaseModel
|
@@ -15,6 +15,7 @@ class BadCommandFormat(Exception):
|
|
15
15
|
|
16
16
|
class ParsedCommand(BaseModel):
|
17
17
|
command: str
|
18
|
+
full_command: str
|
18
19
|
key_to_value: dict[str, str | None] = {}
|
19
20
|
values_without_key: list[str] = []
|
20
21
|
|
@@ -67,6 +68,7 @@ class ParsedCommand(BaseModel):
|
|
67
68
|
|
68
69
|
|
69
70
|
def parse_command(text: str) -> ParsedCommand:
|
71
|
+
text = text.removeprefix("/")
|
70
72
|
text = " ".join([text_.strip() for text_ in text.split(" ") if text_.strip()]).strip()
|
71
73
|
|
72
74
|
parts = shlex.split(text)
|
@@ -75,7 +77,7 @@ def parse_command(text: str) -> ParsedCommand:
|
|
75
77
|
if len(parts[0]) == 1:
|
76
78
|
raise BadCommandFormat("len(parts[0]) == 1")
|
77
79
|
|
78
|
-
res = ParsedCommand(command=parts[0])
|
80
|
+
res = ParsedCommand(full_command=parts[0], command=os.path.basename(parts[0]).removeprefix("/"))
|
79
81
|
|
80
82
|
last_key: str | None = None
|
81
83
|
for part in parts[1:]:
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# arpakit
|
2
|
+
|
3
|
+
import logging
|
4
|
+
import os
|
5
|
+
|
6
|
+
from arpakitlib.ar_str_util import make_none_if_blank
|
7
|
+
|
8
|
+
_ARPAKIT_LIB_MODULE_VERSION = "3.0"
|
9
|
+
|
10
|
+
_logger = logging.getLogger(__name__)
|
11
|
+
|
12
|
+
|
13
|
+
def init_arpakit_project_template(
|
14
|
+
*,
|
15
|
+
project_dirpath: str,
|
16
|
+
overwrite_if_exists: bool = False,
|
17
|
+
project_name: str | None = None,
|
18
|
+
ignore_paths_startswith: list[str] | str | None = None
|
19
|
+
):
|
20
|
+
if project_name:
|
21
|
+
project_name = project_name.strip()
|
22
|
+
project_name = make_none_if_blank(project_name)
|
23
|
+
|
24
|
+
if isinstance(ignore_paths_startswith, str):
|
25
|
+
ignore_paths_startswith = [ignore_paths_startswith]
|
26
|
+
if ignore_paths_startswith is None:
|
27
|
+
ignore_paths_startswith = []
|
28
|
+
|
29
|
+
def _generate_filepath_to_content() -> dict[str, str]:
|
30
|
+
arpakit_project_template_dirpath = os.path.abspath("_arpakit_project_template")
|
31
|
+
res = {}
|
32
|
+
for root, dirs, files in os.walk(arpakit_project_template_dirpath):
|
33
|
+
dirs[:] = [d for d in dirs if d != '__pycache__']
|
34
|
+
for file in files:
|
35
|
+
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}")
|
38
|
+
continue
|
39
|
+
with open(os.path.join(root, file), "r", encoding='utf-8') as _file:
|
40
|
+
_content = _file.read()
|
41
|
+
if project_name:
|
42
|
+
_content = _content.replace("{PROJECT_NAME}", project_name)
|
43
|
+
res[rel_path] = _content
|
44
|
+
return res
|
45
|
+
|
46
|
+
filepath_to_content = _generate_filepath_to_content()
|
47
|
+
|
48
|
+
if not os.path.exists(project_dirpath):
|
49
|
+
os.makedirs(project_dirpath)
|
50
|
+
|
51
|
+
for filepath, content in filepath_to_content.items():
|
52
|
+
full_filepath = os.path.join(project_dirpath, filepath)
|
53
|
+
|
54
|
+
if os.path.exists(full_filepath) and not overwrite_if_exists:
|
55
|
+
_logger.info(f"file exists and overwrite_if_exists is False, skipping: {full_filepath}")
|
56
|
+
continue
|
57
|
+
|
58
|
+
_logger.info(f"creating file: {full_filepath}")
|
59
|
+
os.makedirs(os.path.dirname(full_filepath), exist_ok=True)
|
60
|
+
with open(full_filepath, "w", encoding="utf-8") as file_:
|
61
|
+
file_.write(content)
|
62
|
+
_logger.info(f"file created: {full_filepath}")
|
@@ -52,12 +52,18 @@ def bidirectional_str_startswith(string1: str, string2: str, max_diff: Optional[
|
|
52
52
|
return False
|
53
53
|
|
54
54
|
|
55
|
-
def
|
55
|
+
def make_blank_if_none(string: Optional[str] = None) -> str:
|
56
56
|
if string is None:
|
57
57
|
return ""
|
58
58
|
return string
|
59
59
|
|
60
60
|
|
61
|
+
def make_none_if_blank(string: Optional[str] = None) -> str:
|
62
|
+
if not string:
|
63
|
+
return None
|
64
|
+
return string
|
65
|
+
|
66
|
+
|
61
67
|
def remove_html(string: str) -> str:
|
62
68
|
raise_for_type(string, str)
|
63
69
|
return BeautifulSoup(string, "html.parser").text
|
@@ -73,7 +79,7 @@ def remove_tags_and_html(string: str) -> str:
|
|
73
79
|
return remove_tags(remove_html(string))
|
74
80
|
|
75
81
|
|
76
|
-
def
|
82
|
+
def raise_if_blank(string: str) -> str:
|
77
83
|
if not string:
|
78
84
|
raise ValueError("not string")
|
79
85
|
return string
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# arpakit
|
2
|
-
|
3
|
-
import logging
|
4
|
-
import sys
|
5
|
-
|
6
|
-
from arpakitlib.ar_need_type_util import parse_need_type, NeedTypes
|
7
|
-
from arpakitlib.ar_parse_command import parse_command
|
8
|
-
from arpakitlib.ar_project_template_util import init_arpakit_project_template
|
9
|
-
from arpakitlib.ar_str_util import raise_if_string_blank
|
10
|
-
|
11
|
-
_logger = logging.getLogger(__name__)
|
12
|
-
|
13
|
-
|
14
|
-
def _arpakitlib_cli(*, full_command: str):
|
15
|
-
_logger.info("start _arpakitlib_cli")
|
16
|
-
|
17
|
-
parsed_command = parse_command(text=full_command)
|
18
|
-
parsed_command.raise_for_command(needed_command="arpakitlib", lower_=True)
|
19
|
-
|
20
|
-
command = parsed_command.get_value_by_keys(keys=["command", "c"])
|
21
|
-
if command:
|
22
|
-
command = command.strip()
|
23
|
-
if not command:
|
24
|
-
raise Exception(f"not command, command={command}")
|
25
|
-
|
26
|
-
_logger.info(f"start {command}")
|
27
|
-
|
28
|
-
if command == "help":
|
29
|
-
pass
|
30
|
-
|
31
|
-
elif command == "init_arpakit_project_template":
|
32
|
-
project_dirpath = raise_if_string_blank(parsed_command.get_value_by_keys(keys=["pd", "project_dirpath"]))
|
33
|
-
remove_if_exists: bool = parse_need_type(
|
34
|
-
value=parsed_command.get_value_by_keys(keys=["rie", "remove_if_exists"]),
|
35
|
-
need_type=NeedTypes.bool_
|
36
|
-
)
|
37
|
-
project_name = raise_if_string_blank(parsed_command.get_value_by_keys(keys=["pm", "project_name"]))
|
38
|
-
init_arpakit_project_template(
|
39
|
-
project_dirpath=project_dirpath, remove_if_exists=remove_if_exists, project_name=project_name
|
40
|
-
)
|
41
|
-
|
42
|
-
else:
|
43
|
-
raise Exception(f"not recognized command, command={command}")
|
44
|
-
|
45
|
-
_logger.info(f"finish {command}")
|
46
|
-
|
47
|
-
_logger.info("finish _arpakitlib_cli")
|
48
|
-
|
49
|
-
|
50
|
-
if __name__ == '__main__':
|
51
|
-
_arpakitlib_cli(full_command=" ".join(sys.argv))
|
@@ -1,55 +0,0 @@
|
|
1
|
-
# arpakit
|
2
|
-
import logging
|
3
|
-
import os
|
4
|
-
|
5
|
-
from arpakitlib.ar_file_util import raise_if_path_not_exists
|
6
|
-
|
7
|
-
_ARPAKIT_LIB_MODULE_VERSION = "3.0"
|
8
|
-
|
9
|
-
_logger = logging.getLogger(__name__)
|
10
|
-
|
11
|
-
|
12
|
-
def init_arpakit_project_template(
|
13
|
-
*, project_dirpath: str, remove_if_exists: bool = False, project_name: str | None = None
|
14
|
-
):
|
15
|
-
if project_name:
|
16
|
-
project_name = project_name.strip()
|
17
|
-
if not project_name:
|
18
|
-
project_name = None
|
19
|
-
|
20
|
-
source_template_dirpath = os.path.join(os.path.dirname(__file__), "_arpakit_project_template")
|
21
|
-
|
22
|
-
raise_if_path_not_exists(path=source_template_dirpath)
|
23
|
-
|
24
|
-
project_dirpath = os.path.abspath(project_dirpath)
|
25
|
-
|
26
|
-
filepath_to_content = {}
|
27
|
-
|
28
|
-
for root_filepath, dir_filepaths, file_filepaths in os.walk(source_template_dirpath):
|
29
|
-
dir_filepaths[:] = [d for d in dir_filepaths if d != "__pycache__"]
|
30
|
-
relative_filepath = os.path.relpath(root_filepath, source_template_dirpath)
|
31
|
-
target_root_filepath = os.path.normpath(os.path.join(project_dirpath, relative_filepath))
|
32
|
-
for file in file_filepaths:
|
33
|
-
source_file_filepath = os.path.join(root_filepath, file)
|
34
|
-
target_file_filepath = os.path.normpath(os.path.join(target_root_filepath, file))
|
35
|
-
|
36
|
-
with open(source_file_filepath, "r", encoding="utf-8") as f:
|
37
|
-
content = f.read()
|
38
|
-
|
39
|
-
if project_name is not None:
|
40
|
-
content = content.replace("{PROJECT_NAME}", project_name)
|
41
|
-
|
42
|
-
filepath_to_content[target_file_filepath] = content
|
43
|
-
|
44
|
-
if not os.path.exists(project_dirpath):
|
45
|
-
os.makedirs(project_dirpath)
|
46
|
-
|
47
|
-
for target_file_filepath, content in filepath_to_content.items():
|
48
|
-
if os.path.exists(target_file_filepath) and not remove_if_exists:
|
49
|
-
_logger.info(f"skip existing file: {target_file_filepath}")
|
50
|
-
continue
|
51
|
-
_logger.info(f"initing file: {target_file_filepath}")
|
52
|
-
os.makedirs(os.path.dirname(target_file_filepath), exist_ok=True)
|
53
|
-
with open(target_file_filepath, "w", encoding="utf-8") as f:
|
54
|
-
f.write(content)
|
55
|
-
_logger.info(f"file was inited: {target_file_filepath}")
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/.python-version
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/__init__.py
RENAMED
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/beutify_json.py
RENAMED
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/docker_ps.sh
RENAMED
File without changes
|
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/git_commit.sh
RENAMED
File without changes
|
File without changes
|
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/git_remote_v.sh
RENAMED
File without changes
|
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/git_status.sh
RENAMED
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/hello_world.py
RENAMED
File without changes
|
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/poetry_check.sh
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/poetry_lock.sh
RENAMED
File without changes
|
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/poetry_show.sh
RENAMED
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/manage/poetry_update.sh
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/src/core/const.py
RENAMED
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/src/core/settings.py
RENAMED
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/_arpakit_project_template/src/core/util.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_arpakit_schedule_uust_api_client_util.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/redoc/redoc.standalone.js
RENAMED
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/favicon-16x16.png
RENAMED
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/favicon-32x32.png
RENAMED
File without changes
|
File without changes
|
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/oauth2-redirect.html
RENAMED
File without changes
|
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui-bundle.js
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.css
RENAMED
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.css.map
RENAMED
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js
RENAMED
File without changes
|
{arpakitlib-1.6.72 → arpakitlib-1.6.75}/arpakitlib/ar_fastapi_static/swagger-ui/swagger-ui.js.map
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|