dycw-actions 0.14.0__py3-none-any.whl → 0.15.5__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.
- actions/__init__.py +1 -1
- actions/cli.py +2 -1
- actions/pre_commit/conformalize_repo/constants.py +9 -1
- actions/pre_commit/conformalize_repo/lib.py +130 -20
- actions/pre_commit/update_requirements/lib.py +30 -1
- actions/pre_commit/utilities.py +20 -13
- actions/register_gitea_runner/settings.py +1 -2
- actions/setup_cronjob/settings.py +1 -1
- actions/utilities.py +0 -16
- dycw_actions-0.15.5.dist-info/METADATA +45 -0
- {dycw_actions-0.14.0.dist-info → dycw_actions-0.15.5.dist-info}/RECORD +13 -14
- {dycw_actions-0.14.0.dist-info → dycw_actions-0.15.5.dist-info}/WHEEL +2 -2
- dycw_actions-0.15.5.dist-info/entry_points.txt +3 -0
- actions/.DS_Store +0 -0
- dycw_actions-0.14.0.dist-info/METADATA +0 -26
- dycw_actions-0.14.0.dist-info/entry_points.txt +0 -3
actions/__init__.py
CHANGED
actions/cli.py
CHANGED
|
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
from click import group
|
|
4
4
|
from utilities.click import CONTEXT_SETTINGS
|
|
5
5
|
|
|
6
|
+
from actions import __version__
|
|
6
7
|
from actions.clean_dir.cli import clean_dir_sub_cmd
|
|
7
8
|
from actions.clean_dir.constants import CLEAN_DIR_DOCSTRING, CLEAN_DIR_SUB_CMD
|
|
8
9
|
from actions.git_clone_with.cli import git_clone_with_sub_cmd
|
|
@@ -70,7 +71,7 @@ from actions.tag_commit.cli import tag_commit_sub_cmd
|
|
|
70
71
|
from actions.tag_commit.constants import TAG_COMMIT_DOCSTRING, TAG_COMMIT_SUB_CMD
|
|
71
72
|
|
|
72
73
|
|
|
73
|
-
@group(**CONTEXT_SETTINGS)
|
|
74
|
+
@group(help=f"'actions' {__version__}", **CONTEXT_SETTINGS)
|
|
74
75
|
def _main() -> None: ...
|
|
75
76
|
|
|
76
77
|
|
|
@@ -3,11 +3,12 @@ from __future__ import annotations
|
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
from re import search
|
|
5
5
|
|
|
6
|
+
from utilities.constants import IS_CI
|
|
6
7
|
from utilities.pathlib import GetRootError, get_root
|
|
7
|
-
from utilities.pytest import IS_CI
|
|
8
8
|
|
|
9
9
|
from actions.pre_commit.constants import PATH_PRE_COMMIT
|
|
10
10
|
|
|
11
|
+
BUILTIN = "builtin"
|
|
11
12
|
DOCKERFMT_URL = "https://github.com/reteps/dockerfmt"
|
|
12
13
|
PRE_COMMIT_HOOKS_URL = "https://github.com/pre-commit/pre-commit-hooks"
|
|
13
14
|
RUFF_URL = "https://github.com/astral-sh/ruff-pre-commit"
|
|
@@ -21,6 +22,10 @@ CONFORMALIZE_REPO_DOCSTRING = "Conformalize a repo"
|
|
|
21
22
|
CONFORMALIZE_REPO_SUB_CMD = "conformalize-repo"
|
|
22
23
|
|
|
23
24
|
|
|
25
|
+
FORMATTER_PRIORITY = 10
|
|
26
|
+
LINTER_PRIORITY = 20
|
|
27
|
+
|
|
28
|
+
|
|
24
29
|
PATH_CONFIGS = PATH_PRE_COMMIT / "conformalize_repo/configs"
|
|
25
30
|
|
|
26
31
|
|
|
@@ -32,9 +37,12 @@ RUN_VERSION_BUMP = all(not search("template", p) for p in root.parts) and not IS
|
|
|
32
37
|
|
|
33
38
|
|
|
34
39
|
__all__ = [
|
|
40
|
+
"BUILTIN",
|
|
35
41
|
"CONFORMALIZE_REPO_DOCSTRING",
|
|
36
42
|
"CONFORMALIZE_REPO_SUB_CMD",
|
|
37
43
|
"DOCKERFMT_URL",
|
|
44
|
+
"FORMATTER_PRIORITY",
|
|
45
|
+
"LINTER_PRIORITY",
|
|
38
46
|
"PATH_CONFIGS",
|
|
39
47
|
"PRE_COMMIT_HOOKS_URL",
|
|
40
48
|
"RUFF_URL",
|
|
@@ -55,8 +55,11 @@ from actions.pre_commit.conformalize_repo.action_dicts import (
|
|
|
55
55
|
update_ca_certificates_dict,
|
|
56
56
|
)
|
|
57
57
|
from actions.pre_commit.conformalize_repo.constants import (
|
|
58
|
+
BUILTIN,
|
|
58
59
|
CONFORMALIZE_REPO_SUB_CMD,
|
|
59
60
|
DOCKERFMT_URL,
|
|
61
|
+
FORMATTER_PRIORITY,
|
|
62
|
+
LINTER_PRIORITY,
|
|
60
63
|
PATH_CONFIGS,
|
|
61
64
|
PRE_COMMIT_HOOKS_URL,
|
|
62
65
|
RUFF_URL,
|
|
@@ -741,6 +744,7 @@ def _add_envrc_uv_text(
|
|
|
741
744
|
strip_and_dedent(f"""
|
|
742
745
|
export UV_PRERELEASE='disallow'
|
|
743
746
|
export UV_PYTHON='{python_version}'
|
|
747
|
+
export UV_RESOLUTION='highest'
|
|
744
748
|
export UV_VENV_CLEAR=1
|
|
745
749
|
if ! command -v uv >/dev/null 2>&1; then
|
|
746
750
|
\techo_date "ERROR: 'uv' not found" && exit 1
|
|
@@ -791,33 +795,95 @@ def add_pre_commit_config_yaml(
|
|
|
791
795
|
uv__native_tls: bool = SETTINGS.uv__native_tls,
|
|
792
796
|
) -> None:
|
|
793
797
|
with yield_yaml_dict(PRE_COMMIT_CONFIG_YAML, modifications=modifications) as dict_:
|
|
794
|
-
_add_pre_commit_config_repo(dict_, ACTIONS_URL, CONFORMALIZE_REPO_SUB_CMD)
|
|
795
798
|
_add_pre_commit_config_repo(
|
|
796
|
-
dict_,
|
|
799
|
+
dict_,
|
|
800
|
+
ACTIONS_URL,
|
|
801
|
+
CONFORMALIZE_REPO_SUB_CMD,
|
|
802
|
+
rev=True,
|
|
803
|
+
priority=FORMATTER_PRIORITY,
|
|
804
|
+
)
|
|
805
|
+
_add_pre_commit_config_repo(
|
|
806
|
+
dict_, BUILTIN, "check-added-large-files", priority=LINTER_PRIORITY
|
|
807
|
+
)
|
|
808
|
+
_add_pre_commit_config_repo(
|
|
809
|
+
dict_, BUILTIN, "check-case-conflict", priority=LINTER_PRIORITY
|
|
810
|
+
)
|
|
811
|
+
_add_pre_commit_config_repo(
|
|
812
|
+
dict_, BUILTIN, "check-executables-have-shebangs", priority=LINTER_PRIORITY
|
|
813
|
+
)
|
|
814
|
+
_add_pre_commit_config_repo(
|
|
815
|
+
dict_, BUILTIN, "check-json", priority=LINTER_PRIORITY
|
|
816
|
+
)
|
|
817
|
+
_add_pre_commit_config_repo(
|
|
818
|
+
dict_, BUILTIN, "check-json5", priority=LINTER_PRIORITY
|
|
819
|
+
)
|
|
820
|
+
_add_pre_commit_config_repo(
|
|
821
|
+
dict_, BUILTIN, "check-merge-conflict", priority=LINTER_PRIORITY
|
|
822
|
+
)
|
|
823
|
+
_add_pre_commit_config_repo(
|
|
824
|
+
dict_, BUILTIN, "check-symlinks", priority=LINTER_PRIORITY
|
|
797
825
|
)
|
|
798
|
-
_add_pre_commit_config_repo(dict_, PRE_COMMIT_HOOKS_URL, "check-merge-conflict")
|
|
799
|
-
_add_pre_commit_config_repo(dict_, PRE_COMMIT_HOOKS_URL, "check-symlinks")
|
|
800
|
-
_add_pre_commit_config_repo(dict_, PRE_COMMIT_HOOKS_URL, "destroyed-symlinks")
|
|
801
|
-
_add_pre_commit_config_repo(dict_, PRE_COMMIT_HOOKS_URL, "detect-private-key")
|
|
802
|
-
_add_pre_commit_config_repo(dict_, PRE_COMMIT_HOOKS_URL, "end-of-file-fixer")
|
|
803
826
|
_add_pre_commit_config_repo(
|
|
804
|
-
dict_,
|
|
827
|
+
dict_, BUILTIN, "check-toml", priority=LINTER_PRIORITY
|
|
828
|
+
)
|
|
829
|
+
_add_pre_commit_config_repo(
|
|
830
|
+
dict_, BUILTIN, "check-xml", priority=LINTER_PRIORITY
|
|
831
|
+
)
|
|
832
|
+
_add_pre_commit_config_repo(
|
|
833
|
+
dict_, BUILTIN, "check-yaml", priority=LINTER_PRIORITY
|
|
834
|
+
)
|
|
835
|
+
_add_pre_commit_config_repo(
|
|
836
|
+
dict_, BUILTIN, "detect-private-key", priority=LINTER_PRIORITY
|
|
837
|
+
)
|
|
838
|
+
_add_pre_commit_config_repo(
|
|
839
|
+
dict_, BUILTIN, "end-of-file-fixer", priority=FORMATTER_PRIORITY
|
|
840
|
+
)
|
|
841
|
+
_add_pre_commit_config_repo(
|
|
842
|
+
dict_, BUILTIN, "fix-byte-order-marker", priority=FORMATTER_PRIORITY
|
|
843
|
+
)
|
|
844
|
+
_add_pre_commit_config_repo(
|
|
845
|
+
dict_,
|
|
846
|
+
BUILTIN,
|
|
847
|
+
"mixed-line-ending",
|
|
848
|
+
args=("add", ["--fix=lf"]),
|
|
849
|
+
priority=FORMATTER_PRIORITY,
|
|
850
|
+
)
|
|
851
|
+
_add_pre_commit_config_repo(
|
|
852
|
+
dict_, BUILTIN, "no-commit-to-branch", priority=LINTER_PRIORITY
|
|
853
|
+
)
|
|
854
|
+
_add_pre_commit_config_repo(
|
|
855
|
+
dict_, BUILTIN, "trailing-whitespace", priority=FORMATTER_PRIORITY
|
|
856
|
+
)
|
|
857
|
+
_add_pre_commit_config_repo(
|
|
858
|
+
dict_,
|
|
859
|
+
PRE_COMMIT_HOOKS_URL,
|
|
860
|
+
"check-illegal-windows-names",
|
|
861
|
+
rev=True,
|
|
862
|
+
priority=LINTER_PRIORITY,
|
|
863
|
+
)
|
|
864
|
+
_add_pre_commit_config_repo(
|
|
865
|
+
dict_,
|
|
866
|
+
PRE_COMMIT_HOOKS_URL,
|
|
867
|
+
"destroyed-symlinks",
|
|
868
|
+
rev=True,
|
|
869
|
+
priority=LINTER_PRIORITY,
|
|
805
870
|
)
|
|
806
|
-
_add_pre_commit_config_repo(dict_, PRE_COMMIT_HOOKS_URL, "no-commit-to-branch")
|
|
807
871
|
_add_pre_commit_config_repo(
|
|
808
872
|
dict_,
|
|
809
873
|
PRE_COMMIT_HOOKS_URL,
|
|
810
874
|
"pretty-format-json",
|
|
875
|
+
rev=True,
|
|
811
876
|
args=("add", ["--autofix"]),
|
|
877
|
+
priority=FORMATTER_PRIORITY,
|
|
812
878
|
)
|
|
813
|
-
_add_pre_commit_config_repo(dict_, PRE_COMMIT_HOOKS_URL, "no-commit-to-branch")
|
|
814
|
-
_add_pre_commit_config_repo(dict_, PRE_COMMIT_HOOKS_URL, "trailing-whitespace")
|
|
815
879
|
if dockerfmt:
|
|
816
880
|
_add_pre_commit_config_repo(
|
|
817
881
|
dict_,
|
|
818
882
|
DOCKERFMT_URL,
|
|
819
883
|
"dockerfmt",
|
|
884
|
+
rev=True,
|
|
820
885
|
args=("add", ["--newline", "--write"]),
|
|
886
|
+
priority=FORMATTER_PRIORITY,
|
|
821
887
|
)
|
|
822
888
|
if prettier:
|
|
823
889
|
_add_pre_commit_config_repo(
|
|
@@ -828,14 +894,37 @@ def add_pre_commit_config_yaml(
|
|
|
828
894
|
entry="npx prettier --write",
|
|
829
895
|
language="system",
|
|
830
896
|
types_or=["markdown", "yaml"],
|
|
897
|
+
priority=FORMATTER_PRIORITY,
|
|
831
898
|
)
|
|
832
899
|
if python:
|
|
833
|
-
_add_pre_commit_config_repo(dict_, ACTIONS_URL, FORMAT_REQUIREMENTS_SUB_CMD)
|
|
834
900
|
_add_pre_commit_config_repo(
|
|
835
|
-
dict_,
|
|
901
|
+
dict_,
|
|
902
|
+
ACTIONS_URL,
|
|
903
|
+
FORMAT_REQUIREMENTS_SUB_CMD,
|
|
904
|
+
rev=True,
|
|
905
|
+
priority=FORMATTER_PRIORITY,
|
|
906
|
+
)
|
|
907
|
+
_add_pre_commit_config_repo(
|
|
908
|
+
dict_,
|
|
909
|
+
ACTIONS_URL,
|
|
910
|
+
REPLACE_SEQUENCE_STRS_SUB_CMD,
|
|
911
|
+
rev=True,
|
|
912
|
+
priority=FORMATTER_PRIORITY,
|
|
913
|
+
)
|
|
914
|
+
_add_pre_commit_config_repo(
|
|
915
|
+
dict_,
|
|
916
|
+
ACTIONS_URL,
|
|
917
|
+
TOUCH_EMPTY_PY_SUB_CMD,
|
|
918
|
+
rev=True,
|
|
919
|
+
priority=FORMATTER_PRIORITY,
|
|
920
|
+
)
|
|
921
|
+
_add_pre_commit_config_repo(
|
|
922
|
+
dict_,
|
|
923
|
+
ACTIONS_URL,
|
|
924
|
+
TOUCH_PY_TYPED_SUB_CMD,
|
|
925
|
+
rev=True,
|
|
926
|
+
priority=FORMATTER_PRIORITY,
|
|
836
927
|
)
|
|
837
|
-
_add_pre_commit_config_repo(dict_, ACTIONS_URL, TOUCH_EMPTY_PY_SUB_CMD)
|
|
838
|
-
_add_pre_commit_config_repo(dict_, ACTIONS_URL, TOUCH_PY_TYPED_SUB_CMD)
|
|
839
928
|
args: list[str] = []
|
|
840
929
|
if len(uv__indexes) >= 1:
|
|
841
930
|
args.extend(["--index", ",".join(v for _, v in uv__indexes)])
|
|
@@ -845,21 +934,35 @@ def add_pre_commit_config_yaml(
|
|
|
845
934
|
dict_,
|
|
846
935
|
ACTIONS_URL,
|
|
847
936
|
UPDATE_REQUIREMENTS_SUB_CMD,
|
|
937
|
+
rev=True,
|
|
848
938
|
args=("add", args) if len(args) >= 1 else None,
|
|
939
|
+
priority=FORMATTER_PRIORITY,
|
|
849
940
|
)
|
|
850
941
|
if ruff:
|
|
851
942
|
_add_pre_commit_config_repo(
|
|
852
|
-
dict_,
|
|
943
|
+
dict_,
|
|
944
|
+
RUFF_URL,
|
|
945
|
+
"ruff-check",
|
|
946
|
+
rev=True,
|
|
947
|
+
args=("add", ["--fix"]),
|
|
948
|
+
priority=LINTER_PRIORITY,
|
|
949
|
+
)
|
|
950
|
+
_add_pre_commit_config_repo(
|
|
951
|
+
dict_, RUFF_URL, "ruff-format", rev=True, priority=FORMATTER_PRIORITY
|
|
853
952
|
)
|
|
854
|
-
_add_pre_commit_config_repo(dict_, RUFF_URL, "ruff-format")
|
|
855
953
|
if shell:
|
|
856
|
-
_add_pre_commit_config_repo(
|
|
857
|
-
|
|
954
|
+
_add_pre_commit_config_repo(
|
|
955
|
+
dict_, SHFMT_URL, "shfmt", rev=True, priority=FORMATTER_PRIORITY
|
|
956
|
+
)
|
|
957
|
+
_add_pre_commit_config_repo(
|
|
958
|
+
dict_, SHELLCHECK_URL, "shellcheck", rev=True, priority=LINTER_PRIORITY
|
|
959
|
+
)
|
|
858
960
|
if taplo:
|
|
859
961
|
_add_pre_commit_config_repo(
|
|
860
962
|
dict_,
|
|
861
963
|
TAPLO_URL,
|
|
862
964
|
"taplo-format",
|
|
965
|
+
rev=True,
|
|
863
966
|
args=(
|
|
864
967
|
"exact",
|
|
865
968
|
[
|
|
@@ -871,6 +974,7 @@ def add_pre_commit_config_yaml(
|
|
|
871
974
|
"reorder_keys=true",
|
|
872
975
|
],
|
|
873
976
|
),
|
|
977
|
+
priority=FORMATTER_PRIORITY,
|
|
874
978
|
)
|
|
875
979
|
if uv:
|
|
876
980
|
args: list[str] = [
|
|
@@ -886,8 +990,10 @@ def add_pre_commit_config_yaml(
|
|
|
886
990
|
dict_,
|
|
887
991
|
UV_URL,
|
|
888
992
|
"uv-lock",
|
|
993
|
+
rev=True,
|
|
889
994
|
files=None if script is None else rf"^{escape(script)}$",
|
|
890
995
|
args=("add", args),
|
|
996
|
+
priority=FORMATTER_PRIORITY,
|
|
891
997
|
)
|
|
892
998
|
|
|
893
999
|
|
|
@@ -897,16 +1003,18 @@ def _add_pre_commit_config_repo(
|
|
|
897
1003
|
id_: str,
|
|
898
1004
|
/,
|
|
899
1005
|
*,
|
|
1006
|
+
rev: bool = False,
|
|
900
1007
|
name: str | None = None,
|
|
901
1008
|
entry: str | None = None,
|
|
902
1009
|
language: str | None = None,
|
|
903
1010
|
files: str | None = None,
|
|
904
1011
|
types_or: list[str] | None = None,
|
|
905
1012
|
args: tuple[Literal["add", "exact"], list[str]] | None = None,
|
|
1013
|
+
priority: int | None = None,
|
|
906
1014
|
) -> None:
|
|
907
1015
|
repos_list = get_set_list_dicts(pre_commit_dict, "repos")
|
|
908
1016
|
repo_dict = ensure_contains_partial_dict(
|
|
909
|
-
repos_list, {"repo": url}, extra={
|
|
1017
|
+
repos_list, {"repo": url}, extra={"rev": "master"} if rev else {}
|
|
910
1018
|
)
|
|
911
1019
|
hooks_list = get_set_list_dicts(repo_dict, "hooks")
|
|
912
1020
|
hook_dict = ensure_contains_partial_dict(hooks_list, {"id": id_})
|
|
@@ -929,6 +1037,8 @@ def _add_pre_commit_config_repo(
|
|
|
929
1037
|
hook_dict["args"] = args_i
|
|
930
1038
|
case never:
|
|
931
1039
|
assert_never(never)
|
|
1040
|
+
if priority is not None:
|
|
1041
|
+
hook_dict["priority"] = priority
|
|
932
1042
|
|
|
933
1043
|
|
|
934
1044
|
##
|
|
@@ -6,7 +6,9 @@ from typing import TYPE_CHECKING
|
|
|
6
6
|
|
|
7
7
|
from ordered_set import OrderedSet
|
|
8
8
|
from pydantic import TypeAdapter
|
|
9
|
+
from tomlkit import string
|
|
9
10
|
from utilities.functions import ensure_str, get_func_name, max_nullable
|
|
11
|
+
from utilities.packaging import Requirement
|
|
10
12
|
from utilities.tabulate import func_param_desc
|
|
11
13
|
from utilities.text import repr_str
|
|
12
14
|
|
|
@@ -25,6 +27,8 @@ from actions.pre_commit.update_requirements.settings import SETTINGS
|
|
|
25
27
|
from actions.pre_commit.utilities import (
|
|
26
28
|
get_aot,
|
|
27
29
|
get_pyproject_dependencies,
|
|
30
|
+
get_set_array,
|
|
31
|
+
get_set_table,
|
|
28
32
|
get_table,
|
|
29
33
|
yield_pyproject_toml,
|
|
30
34
|
yield_toml_doc,
|
|
@@ -35,7 +39,7 @@ if TYPE_CHECKING:
|
|
|
35
39
|
from collections.abc import Iterator, MutableSet
|
|
36
40
|
from pathlib import Path
|
|
37
41
|
|
|
38
|
-
from
|
|
42
|
+
from tomlkit import TOMLDocument
|
|
39
43
|
from utilities.types import PathLike, StrDict
|
|
40
44
|
|
|
41
45
|
from actions.pre_commit.update_requirements.classes import Version2or3, VersionSet
|
|
@@ -87,6 +91,7 @@ def _format_path(
|
|
|
87
91
|
get_pyproject_dependencies(doc).apply(
|
|
88
92
|
partial(_format_req, versions=versions_use)
|
|
89
93
|
)
|
|
94
|
+
_pin_cli_dependencies(doc, versions_use)
|
|
90
95
|
|
|
91
96
|
|
|
92
97
|
def _get_versions(
|
|
@@ -190,4 +195,28 @@ def _format_req(requirement: Requirement, /, *, versions: VersionSet) -> Require
|
|
|
190
195
|
return requirement
|
|
191
196
|
|
|
192
197
|
|
|
198
|
+
def _pin_cli_dependencies(doc: TOMLDocument, versions: VersionSet, /) -> None:
|
|
199
|
+
try:
|
|
200
|
+
project = get_table(doc, "project")
|
|
201
|
+
except KeyError:
|
|
202
|
+
return
|
|
203
|
+
try:
|
|
204
|
+
_ = get_table(project, "scripts")
|
|
205
|
+
except KeyError:
|
|
206
|
+
return
|
|
207
|
+
dependencies = get_set_array(project, "dependencies")
|
|
208
|
+
opt_dependencies = get_set_table(project, "optional-dependencies")
|
|
209
|
+
cli = get_set_array(opt_dependencies, "cli")
|
|
210
|
+
cli.clear()
|
|
211
|
+
for dep in dependencies:
|
|
212
|
+
req = Requirement(dep)
|
|
213
|
+
try:
|
|
214
|
+
version = versions[req.name]
|
|
215
|
+
except KeyError:
|
|
216
|
+
pass
|
|
217
|
+
else:
|
|
218
|
+
req = req.replace(">=", None).replace("<", None).replace("==", str(version))
|
|
219
|
+
cli.append(string(str(req)))
|
|
220
|
+
|
|
221
|
+
|
|
193
222
|
__all__ = ["update_requirements"]
|
actions/pre_commit/utilities.py
CHANGED
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
4
|
from collections.abc import Iterator, MutableSet
|
|
5
|
-
from contextlib import contextmanager
|
|
5
|
+
from contextlib import contextmanager, suppress
|
|
6
6
|
from dataclasses import dataclass
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
from typing import TYPE_CHECKING, Any, assert_never, overload
|
|
@@ -248,22 +248,29 @@ def is_partial_str(obj: Any, text: str, /) -> bool:
|
|
|
248
248
|
|
|
249
249
|
def get_pyproject_dependencies(doc: TOMLDocument, /) -> PyProjectDependencies:
|
|
250
250
|
out = PyProjectDependencies()
|
|
251
|
-
|
|
252
|
-
project =
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
251
|
+
try:
|
|
252
|
+
project = get_table(doc, "project")
|
|
253
|
+
except KeyError:
|
|
254
|
+
pass
|
|
255
|
+
else:
|
|
256
|
+
with suppress(KeyError):
|
|
257
|
+
out.dependencies = get_array(project, "dependencies")
|
|
258
|
+
try:
|
|
259
|
+
opt_dependencies = get_table(project, "optional-dependencies")
|
|
260
|
+
except KeyError:
|
|
261
|
+
pass
|
|
262
|
+
else:
|
|
257
263
|
out.opt_dependencies = {}
|
|
258
264
|
for key in opt_dependencies:
|
|
259
|
-
out.opt_dependencies[ensure_str(key)] =
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
265
|
+
out.opt_dependencies[ensure_str(key)] = get_array(opt_dependencies, key)
|
|
266
|
+
try:
|
|
267
|
+
dep_grps = get_table(doc, "dependency-groups")
|
|
268
|
+
except KeyError:
|
|
269
|
+
pass
|
|
270
|
+
else:
|
|
264
271
|
out.dep_groups = {}
|
|
265
272
|
for key in dep_grps:
|
|
266
|
-
out.dep_groups[ensure_str(key)] =
|
|
273
|
+
out.dep_groups[ensure_str(key)] = get_array(dep_grps, key)
|
|
267
274
|
return out
|
|
268
275
|
|
|
269
276
|
|
|
@@ -3,8 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
from pathlib import Path
|
|
4
4
|
|
|
5
5
|
from typed_settings import load_settings, option, settings
|
|
6
|
-
from utilities.
|
|
7
|
-
from utilities.socket import HOSTNAME
|
|
6
|
+
from utilities.constants import HOSTNAME, USER
|
|
8
7
|
|
|
9
8
|
from actions.utilities import LOADER
|
|
10
9
|
|
actions/utilities.py
CHANGED
|
@@ -7,7 +7,6 @@ from typing import TYPE_CHECKING, Any, Literal, assert_never, overload
|
|
|
7
7
|
from typed_settings import EnvLoader, Secret
|
|
8
8
|
from utilities.atomicwrites import writer
|
|
9
9
|
from utilities.subprocess import run
|
|
10
|
-
from utilities.text import split_str
|
|
11
10
|
|
|
12
11
|
from actions.constants import YAML_INSTANCE
|
|
13
12
|
from actions.logging import LOGGER
|
|
@@ -71,14 +70,6 @@ def convert_str(x: str | None, /) -> str | None:
|
|
|
71
70
|
assert_never(never)
|
|
72
71
|
|
|
73
72
|
|
|
74
|
-
def copy_text(
|
|
75
|
-
src: PathLike, dest: PathLike, /, *, modifications: MutableSet[Path] | None = None
|
|
76
|
-
) -> None:
|
|
77
|
-
LOGGER.info("Copying '%s' -> '%s'...", str(src), str(dest))
|
|
78
|
-
text = Path(src).read_text()
|
|
79
|
-
write_text(dest, text, modifications=modifications)
|
|
80
|
-
|
|
81
|
-
|
|
82
73
|
def ensure_new_line(text: str, /) -> str:
|
|
83
74
|
return text.strip("\n") + "\n"
|
|
84
75
|
|
|
@@ -132,11 +123,6 @@ def logged_run(
|
|
|
132
123
|
return run(*unwrapped, env=env, print=print, return_=return_, logger=LOGGER)
|
|
133
124
|
|
|
134
125
|
|
|
135
|
-
def split_f_str_equals(text: str, /) -> tuple[str, str]:
|
|
136
|
-
"""Split an `f`-string with `=`."""
|
|
137
|
-
return split_str(text, separator="=", n=2)
|
|
138
|
-
|
|
139
|
-
|
|
140
126
|
def write_text(
|
|
141
127
|
path: PathLike, text: str, /, *, modifications: MutableSet[Path] | None = None
|
|
142
128
|
) -> None:
|
|
@@ -162,10 +148,8 @@ __all__ = [
|
|
|
162
148
|
"convert_list_strs",
|
|
163
149
|
"convert_secret_str",
|
|
164
150
|
"convert_str",
|
|
165
|
-
"copy_text",
|
|
166
151
|
"ensure_new_line",
|
|
167
152
|
"logged_run",
|
|
168
|
-
"split_f_str_equals",
|
|
169
153
|
"write_text",
|
|
170
154
|
"yaml_dump",
|
|
171
155
|
]
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: dycw-actions
|
|
3
|
+
Version: 0.15.5
|
|
4
|
+
Summary: Library of actions
|
|
5
|
+
Requires-Dist: attrs>=25.4.0
|
|
6
|
+
Requires-Dist: click>=8.3.1
|
|
7
|
+
Requires-Dist: coloredlogs>=15.0.1
|
|
8
|
+
Requires-Dist: dycw-utilities>=0.183.4
|
|
9
|
+
Requires-Dist: inflect>=7.5.0
|
|
10
|
+
Requires-Dist: libcst>=1.8.6
|
|
11
|
+
Requires-Dist: ordered-set>=4.1.0
|
|
12
|
+
Requires-Dist: packaging>=25.0
|
|
13
|
+
Requires-Dist: pydantic>=2.12.5
|
|
14
|
+
Requires-Dist: pyyaml>=6.0.3
|
|
15
|
+
Requires-Dist: requests>=2.32.5
|
|
16
|
+
Requires-Dist: rich>=14.2.0
|
|
17
|
+
Requires-Dist: ruamel-yaml>=0.19.1
|
|
18
|
+
Requires-Dist: tabulate>=0.9.0
|
|
19
|
+
Requires-Dist: tomlkit>=0.14.0
|
|
20
|
+
Requires-Dist: typed-settings>=25.3.0
|
|
21
|
+
Requires-Dist: xdg-base-dirs>=6.0.2
|
|
22
|
+
Requires-Dist: attrs==25.4.0 ; extra == 'cli'
|
|
23
|
+
Requires-Dist: click==8.3.1 ; extra == 'cli'
|
|
24
|
+
Requires-Dist: coloredlogs==15.0.1 ; extra == 'cli'
|
|
25
|
+
Requires-Dist: dycw-utilities==0.183.4 ; extra == 'cli'
|
|
26
|
+
Requires-Dist: inflect==7.5.0 ; extra == 'cli'
|
|
27
|
+
Requires-Dist: libcst==1.8.6 ; extra == 'cli'
|
|
28
|
+
Requires-Dist: ordered-set==4.1.0 ; extra == 'cli'
|
|
29
|
+
Requires-Dist: packaging==25.0 ; extra == 'cli'
|
|
30
|
+
Requires-Dist: pydantic==2.12.5 ; extra == 'cli'
|
|
31
|
+
Requires-Dist: pyyaml==6.0.3 ; extra == 'cli'
|
|
32
|
+
Requires-Dist: requests==2.32.5 ; extra == 'cli'
|
|
33
|
+
Requires-Dist: rich==14.2.0 ; extra == 'cli'
|
|
34
|
+
Requires-Dist: ruamel-yaml==0.19.1 ; extra == 'cli'
|
|
35
|
+
Requires-Dist: tabulate==0.9.0 ; extra == 'cli'
|
|
36
|
+
Requires-Dist: tomlkit==0.14.0 ; extra == 'cli'
|
|
37
|
+
Requires-Dist: typed-settings==25.3.0 ; extra == 'cli'
|
|
38
|
+
Requires-Dist: xdg-base-dirs==6.0.2 ; extra == 'cli'
|
|
39
|
+
Requires-Python: >=3.12
|
|
40
|
+
Provides-Extra: cli
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
42
|
+
|
|
43
|
+
# `actions`
|
|
44
|
+
|
|
45
|
+
Library of actions
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
actions
|
|
2
|
-
actions/__init__.py,sha256=zCbvuAxIVQA_nxNBgtPOMhgbVBI6IkR4mFy4PwzrJmE,59
|
|
1
|
+
actions/__init__.py,sha256=z4s0t_yz7R26raF6ZOh1O_A9t9PaD3Dt4ecgWdxslWY,59
|
|
3
2
|
actions/clean_dir/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
4
3
|
actions/clean_dir/cli.py,sha256=OrFA2nEN2LyGF22mhTNEBr7KSuKgX54sGy9RyE73qUc,569
|
|
5
4
|
actions/clean_dir/constants.py,sha256=aDNaYtemEv3lcMXo96Oh4pw_HASMby1GZC1D_gbjPAc,167
|
|
6
5
|
actions/clean_dir/lib.py,sha256=0B8Le09FxAjAFckh69Sq2GPWVN2-asuWRYK9oSWA7sg,1523
|
|
7
6
|
actions/clean_dir/settings.py,sha256=mqM0Oq-yz4dXKcUi3JmOCvDhoeBNQm_Qe70cGmhdcQE,345
|
|
8
|
-
actions/cli.py,sha256=
|
|
7
|
+
actions/cli.py,sha256=jVfhgoGiOEbQvPVnXIUoMKbT9kzranvpWZG0qVIs2fU,5391
|
|
9
8
|
actions/constants.py,sha256=sBspUPK_Wi5hEx_Ro43ACdnW1YtlTC2H4qk7NaGur8w,1646
|
|
10
9
|
actions/git_clone_with/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
11
10
|
actions/git_clone_with/cli.py,sha256=vJY6-jxpnxc6N-Gm7s75iKxiPju0JJqbUs66YTrJFAw,1086
|
|
@@ -19,8 +18,8 @@ actions/pre_commit/conformalize_repo/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8
|
|
|
19
18
|
actions/pre_commit/conformalize_repo/action_dicts.py,sha256=DnOaGdWhGiSgdlh9wINmt6lVKsdTIUO8O-Cvi4mFIgE,8218
|
|
20
19
|
actions/pre_commit/conformalize_repo/cli.py,sha256=-Z7Pn3CPbElZNbk4UPmulQELSlKhIM7wv4WS46Yf2_k,4045
|
|
21
20
|
actions/pre_commit/conformalize_repo/configs/gitignore,sha256=8YCRPwysCD8-67yFXaTg6O8TTl4xeNIh7_DVmaU5Ix0,5063
|
|
22
|
-
actions/pre_commit/conformalize_repo/constants.py,sha256=
|
|
23
|
-
actions/pre_commit/conformalize_repo/lib.py,sha256=
|
|
21
|
+
actions/pre_commit/conformalize_repo/constants.py,sha256=W9FZG6mjXnVTOkiZ28XiMoKM8ryAdRCPRO6E4usyX_k,1367
|
|
22
|
+
actions/pre_commit/conformalize_repo/lib.py,sha256=a825drmTIwkF6wyU5EGOW0A53AHoZNVW_VCsV_24XuI,57556
|
|
24
23
|
actions/pre_commit/conformalize_repo/settings.py,sha256=2x9bxDuFLZvZjYZa0kjDgBYnsfuF2XuGacW_mgOtuPg,6839
|
|
25
24
|
actions/pre_commit/constants.py,sha256=GBxm8GXe7o3M_l314687ZS9JA3Tj_6OMcFJWApYMeh4,247
|
|
26
25
|
actions/pre_commit/format_requirements/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
@@ -43,9 +42,9 @@ actions/pre_commit/update_requirements/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFB
|
|
|
43
42
|
actions/pre_commit/update_requirements/classes.py,sha256=ERC70c1CxQ3rOsQaEtp6FGbK_VaJ4K0jAV5XTB5-L30,3486
|
|
44
43
|
actions/pre_commit/update_requirements/cli.py,sha256=hWMtC4R1NkHh6dKCQr8MwR-Zjmsmpz2vYMGr4HgN9Q4,894
|
|
45
44
|
actions/pre_commit/update_requirements/constants.py,sha256=ve44_RYed_41ckgQNPkb08u7Y1cpLpzutGSL9FdGBF8,228
|
|
46
|
-
actions/pre_commit/update_requirements/lib.py,sha256=
|
|
45
|
+
actions/pre_commit/update_requirements/lib.py,sha256=oRsODobG-kl6God5opQADPDC4sKByeybkG094I1Jxik,7095
|
|
47
46
|
actions/pre_commit/update_requirements/settings.py,sha256=6EepqYra9JIDpBiPaQ1eup8A6S0ENRMQL3wNky6LB00,546
|
|
48
|
-
actions/pre_commit/utilities.py,sha256=
|
|
47
|
+
actions/pre_commit/utilities.py,sha256=H3u4pFzaU5HqcKd4vWf3haScn5apv72-s6PGOEEt3Bo,13799
|
|
49
48
|
actions/publish_package/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
50
49
|
actions/publish_package/cli.py,sha256=nAPHCq67mxUb3yHepVGcoQ69qgaQahM1-cxdbHfxQg0,803
|
|
51
50
|
actions/publish_package/constants.py,sha256=C68ZCVL_jVlYdLGpOK6saZccWoFy5AmC_NMBIWYdYOE,209
|
|
@@ -68,7 +67,7 @@ actions/register_gitea_runner/configs/config.yml,sha256=0kpaqAjMRDqdSxkSK8ydOk2I
|
|
|
68
67
|
actions/register_gitea_runner/configs/entrypoint.sh,sha256=k0K9M38oj3AGHahE1a2011sPoRmYP6Lzu1hvbkjAesw,452
|
|
69
68
|
actions/register_gitea_runner/constants.py,sha256=wX1f5qvhIXngBVWbIQRoIaXIdPaUByvG8HS8P0WcCGM,694
|
|
70
69
|
actions/register_gitea_runner/lib.py,sha256=I8F-CVETA6Jj9Dc9gzXt0DCVjAgrO_-blMdN-3sS8ds,8664
|
|
71
|
-
actions/register_gitea_runner/settings.py,sha256=
|
|
70
|
+
actions/register_gitea_runner/settings.py,sha256=2i2o4GF65PbiUDiiuA7jI9UBWMxyRdB4E2NsrorzMiY,1123
|
|
72
71
|
actions/run_hooks/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
73
72
|
actions/run_hooks/cli.py,sha256=xKBw6iIlHpUlHl6-QWQLSL6KKVjnsihBeJ7h58Rl8P4,616
|
|
74
73
|
actions/run_hooks/constants.py,sha256=JRhDk08qbzo5C-zwHdXZV5ajvNSKh4GcOcBvOIY6IGU,172
|
|
@@ -80,7 +79,7 @@ actions/setup_cronjob/configs/cron.tmpl,sha256=UD_d0LYlB6tbkXAcUTzpGDWVNgIhCR45J
|
|
|
80
79
|
actions/setup_cronjob/configs/logrotate.tmpl,sha256=kkMuCRe4l03er6cFmRI0CXerHYmDumnMXLGKBjXLVxo,137
|
|
81
80
|
actions/setup_cronjob/constants.py,sha256=CNebyWFymrXBx3X9X7XXpU9PSd5wzUN6XkUVomSBnWQ,301
|
|
82
81
|
actions/setup_cronjob/lib.py,sha256=Xyezg08q_lJhlhNoD24iiwujqZOPJT4vnyVbpfo2CdQ,3260
|
|
83
|
-
actions/setup_cronjob/settings.py,sha256=
|
|
82
|
+
actions/setup_cronjob/settings.py,sha256=BnOuYUoJjvXKYz0BJvYlsVvrbPx0H4pCcqdtB92GFDo,992
|
|
84
83
|
actions/setup_ssh_config/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
|
|
85
84
|
actions/setup_ssh_config/cli.py,sha256=lVmMQ1CcSifPVMgQl-nVsFTpLyBvDaFPKYJejhT0zaY,378
|
|
86
85
|
actions/setup_ssh_config/constants.py,sha256=ZWMmq2uBSKUKppD0pmaZ5JSCX2Ty5wJhTHSsS05ygiU,206
|
|
@@ -91,8 +90,8 @@ actions/tag_commit/constants.py,sha256=ceOvQpY4dgtJSd7v_jI1V00S0SjRq2ToGeZu41-DL
|
|
|
91
90
|
actions/tag_commit/lib.py,sha256=1jwduvr_WpDXPVrNFEW-uPmrhndPzenh8wkZ_MNK68U,1792
|
|
92
91
|
actions/tag_commit/settings.py,sha256=TOeKG_GODP--2lBSyGzH_M32jDIfh4vk_Ts06R3_ak4,629
|
|
93
92
|
actions/types.py,sha256=RRzJal-i9J3Yah8vyxJrXiBPUCff4LoMpiPNaPTYFRE,526
|
|
94
|
-
actions/utilities.py,sha256=
|
|
95
|
-
dycw_actions-0.
|
|
96
|
-
dycw_actions-0.
|
|
97
|
-
dycw_actions-0.
|
|
98
|
-
dycw_actions-0.
|
|
93
|
+
actions/utilities.py,sha256=2U7aBpK3XJ_SVdXGO9bQxn2aPFOxq02nxf8Uwso6Qu0,3801
|
|
94
|
+
dycw_actions-0.15.5.dist-info/WHEEL,sha256=XV0cjMrO7zXhVAIyyc8aFf1VjZ33Fen4IiJk5zFlC3g,80
|
|
95
|
+
dycw_actions-0.15.5.dist-info/entry_points.txt,sha256=c3Vrl8JrMg1-FkLKpEiMahoefkRBrFCFXDhX7a-OBfA,43
|
|
96
|
+
dycw_actions-0.15.5.dist-info/METADATA,sha256=Zsj9lUCtuRJTt6nxdyN48MvVChsCoQT4RcNZvILMqvk,1585
|
|
97
|
+
dycw_actions-0.15.5.dist-info/RECORD,,
|
actions/.DS_Store
DELETED
|
Binary file
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: dycw-actions
|
|
3
|
-
Version: 0.14.0
|
|
4
|
-
Summary: Library of actions
|
|
5
|
-
Requires-Dist: click>=8.3.1,<9
|
|
6
|
-
Requires-Dist: coloredlogs>=15.0.1,<16
|
|
7
|
-
Requires-Dist: dycw-utilities>=0.181.0,<1
|
|
8
|
-
Requires-Dist: inflect>=7.5.0,<8
|
|
9
|
-
Requires-Dist: libcst>=1.8.6,<2
|
|
10
|
-
Requires-Dist: ordered-set>=4.1.0,<5
|
|
11
|
-
Requires-Dist: packaging>=25.0,<26
|
|
12
|
-
Requires-Dist: pydantic>=2.12.5,<3
|
|
13
|
-
Requires-Dist: pyyaml>=6.0.3,<7
|
|
14
|
-
Requires-Dist: requests>=2.32.5,<3
|
|
15
|
-
Requires-Dist: rich>=14.2.0,<15
|
|
16
|
-
Requires-Dist: ruamel-yaml>=0.19.1,<1
|
|
17
|
-
Requires-Dist: tabulate>=0.9.0,<1
|
|
18
|
-
Requires-Dist: tomlkit>=0.14.0,<1
|
|
19
|
-
Requires-Dist: typed-settings[attrs,click]>=25.3.0,<26
|
|
20
|
-
Requires-Dist: xdg-base-dirs>=6.0.2,<7
|
|
21
|
-
Requires-Python: >=3.12
|
|
22
|
-
Description-Content-Type: text/markdown
|
|
23
|
-
|
|
24
|
-
# `actions`
|
|
25
|
-
|
|
26
|
-
Library of actions
|