dycw-actions 0.15.3__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 CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.15.3"
3
+ __version__ = "0.15.5"
@@ -8,6 +8,7 @@ from utilities.pathlib import GetRootError, get_root
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,
@@ -792,33 +795,95 @@ def add_pre_commit_config_yaml(
792
795
  uv__native_tls: bool = SETTINGS.uv__native_tls,
793
796
  ) -> None:
794
797
  with yield_yaml_dict(PRE_COMMIT_CONFIG_YAML, modifications=modifications) as dict_:
795
- _add_pre_commit_config_repo(dict_, ACTIONS_URL, CONFORMALIZE_REPO_SUB_CMD)
796
798
  _add_pre_commit_config_repo(
797
- dict_, PRE_COMMIT_HOOKS_URL, "check-executables-have-shebangs"
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
798
825
  )
799
- _add_pre_commit_config_repo(dict_, PRE_COMMIT_HOOKS_URL, "check-merge-conflict")
800
- _add_pre_commit_config_repo(dict_, PRE_COMMIT_HOOKS_URL, "check-symlinks")
801
- _add_pre_commit_config_repo(dict_, PRE_COMMIT_HOOKS_URL, "destroyed-symlinks")
802
- _add_pre_commit_config_repo(dict_, PRE_COMMIT_HOOKS_URL, "detect-private-key")
803
- _add_pre_commit_config_repo(dict_, PRE_COMMIT_HOOKS_URL, "end-of-file-fixer")
804
826
  _add_pre_commit_config_repo(
805
- dict_, PRE_COMMIT_HOOKS_URL, "mixed-line-ending", args=("add", ["--fix=lf"])
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,
806
870
  )
807
- _add_pre_commit_config_repo(dict_, PRE_COMMIT_HOOKS_URL, "no-commit-to-branch")
808
871
  _add_pre_commit_config_repo(
809
872
  dict_,
810
873
  PRE_COMMIT_HOOKS_URL,
811
874
  "pretty-format-json",
875
+ rev=True,
812
876
  args=("add", ["--autofix"]),
877
+ priority=FORMATTER_PRIORITY,
813
878
  )
814
- _add_pre_commit_config_repo(dict_, PRE_COMMIT_HOOKS_URL, "no-commit-to-branch")
815
- _add_pre_commit_config_repo(dict_, PRE_COMMIT_HOOKS_URL, "trailing-whitespace")
816
879
  if dockerfmt:
817
880
  _add_pre_commit_config_repo(
818
881
  dict_,
819
882
  DOCKERFMT_URL,
820
883
  "dockerfmt",
884
+ rev=True,
821
885
  args=("add", ["--newline", "--write"]),
886
+ priority=FORMATTER_PRIORITY,
822
887
  )
823
888
  if prettier:
824
889
  _add_pre_commit_config_repo(
@@ -829,14 +894,37 @@ def add_pre_commit_config_yaml(
829
894
  entry="npx prettier --write",
830
895
  language="system",
831
896
  types_or=["markdown", "yaml"],
897
+ priority=FORMATTER_PRIORITY,
832
898
  )
833
899
  if python:
834
- _add_pre_commit_config_repo(dict_, ACTIONS_URL, FORMAT_REQUIREMENTS_SUB_CMD)
835
900
  _add_pre_commit_config_repo(
836
- dict_, ACTIONS_URL, REPLACE_SEQUENCE_STRS_SUB_CMD
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,
837
927
  )
838
- _add_pre_commit_config_repo(dict_, ACTIONS_URL, TOUCH_EMPTY_PY_SUB_CMD)
839
- _add_pre_commit_config_repo(dict_, ACTIONS_URL, TOUCH_PY_TYPED_SUB_CMD)
840
928
  args: list[str] = []
841
929
  if len(uv__indexes) >= 1:
842
930
  args.extend(["--index", ",".join(v for _, v in uv__indexes)])
@@ -846,21 +934,35 @@ def add_pre_commit_config_yaml(
846
934
  dict_,
847
935
  ACTIONS_URL,
848
936
  UPDATE_REQUIREMENTS_SUB_CMD,
937
+ rev=True,
849
938
  args=("add", args) if len(args) >= 1 else None,
939
+ priority=FORMATTER_PRIORITY,
850
940
  )
851
941
  if ruff:
852
942
  _add_pre_commit_config_repo(
853
- dict_, RUFF_URL, "ruff-check", args=("add", ["--fix"])
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
854
952
  )
855
- _add_pre_commit_config_repo(dict_, RUFF_URL, "ruff-format")
856
953
  if shell:
857
- _add_pre_commit_config_repo(dict_, SHFMT_URL, "shfmt")
858
- _add_pre_commit_config_repo(dict_, SHELLCHECK_URL, "shellcheck")
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
+ )
859
960
  if taplo:
860
961
  _add_pre_commit_config_repo(
861
962
  dict_,
862
963
  TAPLO_URL,
863
964
  "taplo-format",
965
+ rev=True,
864
966
  args=(
865
967
  "exact",
866
968
  [
@@ -872,6 +974,7 @@ def add_pre_commit_config_yaml(
872
974
  "reorder_keys=true",
873
975
  ],
874
976
  ),
977
+ priority=FORMATTER_PRIORITY,
875
978
  )
876
979
  if uv:
877
980
  args: list[str] = [
@@ -887,8 +990,10 @@ def add_pre_commit_config_yaml(
887
990
  dict_,
888
991
  UV_URL,
889
992
  "uv-lock",
993
+ rev=True,
890
994
  files=None if script is None else rf"^{escape(script)}$",
891
995
  args=("add", args),
996
+ priority=FORMATTER_PRIORITY,
892
997
  )
893
998
 
894
999
 
@@ -898,16 +1003,18 @@ def _add_pre_commit_config_repo(
898
1003
  id_: str,
899
1004
  /,
900
1005
  *,
1006
+ rev: bool = False,
901
1007
  name: str | None = None,
902
1008
  entry: str | None = None,
903
1009
  language: str | None = None,
904
1010
  files: str | None = None,
905
1011
  types_or: list[str] | None = None,
906
1012
  args: tuple[Literal["add", "exact"], list[str]] | None = None,
1013
+ priority: int | None = None,
907
1014
  ) -> None:
908
1015
  repos_list = get_set_list_dicts(pre_commit_dict, "repos")
909
1016
  repo_dict = ensure_contains_partial_dict(
910
- repos_list, {"repo": url}, extra={} if url == "local" else {"rev": "master"}
1017
+ repos_list, {"repo": url}, extra={"rev": "master"} if rev else {}
911
1018
  )
912
1019
  hooks_list = get_set_list_dicts(repo_dict, "hooks")
913
1020
  hook_dict = ensure_contains_partial_dict(hooks_list, {"id": id_})
@@ -930,6 +1037,8 @@ def _add_pre_commit_config_repo(
930
1037
  hook_dict["args"] = args_i
931
1038
  case never:
932
1039
  assert_never(never)
1040
+ if priority is not None:
1041
+ hook_dict["priority"] = priority
933
1042
 
934
1043
 
935
1044
  ##
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dycw-actions
3
- Version: 0.15.3
3
+ Version: 0.15.5
4
4
  Summary: Library of actions
5
5
  Requires-Dist: attrs>=25.4.0
6
6
  Requires-Dist: click>=8.3.1
@@ -1,4 +1,4 @@
1
- actions/__init__.py,sha256=XbeoNsmkdaaukFZ-Hixwveh-yF1iPTSeLzRyhJB1fls,59
1
+ actions/__init__.py,sha256=z4s0t_yz7R26raF6ZOh1O_A9t9PaD3Dt4ecgWdxslWY,59
2
2
  actions/clean_dir/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
3
3
  actions/clean_dir/cli.py,sha256=OrFA2nEN2LyGF22mhTNEBr7KSuKgX54sGy9RyE73qUc,569
4
4
  actions/clean_dir/constants.py,sha256=aDNaYtemEv3lcMXo96Oh4pw_HASMby1GZC1D_gbjPAc,167
@@ -18,8 +18,8 @@ actions/pre_commit/conformalize_repo/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8
18
18
  actions/pre_commit/conformalize_repo/action_dicts.py,sha256=DnOaGdWhGiSgdlh9wINmt6lVKsdTIUO8O-Cvi4mFIgE,8218
19
19
  actions/pre_commit/conformalize_repo/cli.py,sha256=-Z7Pn3CPbElZNbk4UPmulQELSlKhIM7wv4WS46Yf2_k,4045
20
20
  actions/pre_commit/conformalize_repo/configs/gitignore,sha256=8YCRPwysCD8-67yFXaTg6O8TTl4xeNIh7_DVmaU5Ix0,5063
21
- actions/pre_commit/conformalize_repo/constants.py,sha256=hAidVV0nQ5SMTkWYFysNSnhBtm-wQS-__EHHDr1sjh0,1236
22
- actions/pre_commit/conformalize_repo/lib.py,sha256=w8EXAYoNqluBBSjvIZp9Zf75WW_tO-3KGmFQB9Xb1ds,54590
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
23
23
  actions/pre_commit/conformalize_repo/settings.py,sha256=2x9bxDuFLZvZjYZa0kjDgBYnsfuF2XuGacW_mgOtuPg,6839
24
24
  actions/pre_commit/constants.py,sha256=GBxm8GXe7o3M_l314687ZS9JA3Tj_6OMcFJWApYMeh4,247
25
25
  actions/pre_commit/format_requirements/__init__.py,sha256=U4S_2y3zgLZVfMenHRaJFBW8yqh2mUBuI291LGQVOJ8,35
@@ -91,7 +91,7 @@ actions/tag_commit/lib.py,sha256=1jwduvr_WpDXPVrNFEW-uPmrhndPzenh8wkZ_MNK68U,179
91
91
  actions/tag_commit/settings.py,sha256=TOeKG_GODP--2lBSyGzH_M32jDIfh4vk_Ts06R3_ak4,629
92
92
  actions/types.py,sha256=RRzJal-i9J3Yah8vyxJrXiBPUCff4LoMpiPNaPTYFRE,526
93
93
  actions/utilities.py,sha256=2U7aBpK3XJ_SVdXGO9bQxn2aPFOxq02nxf8Uwso6Qu0,3801
94
- dycw_actions-0.15.3.dist-info/WHEEL,sha256=XV0cjMrO7zXhVAIyyc8aFf1VjZ33Fen4IiJk5zFlC3g,80
95
- dycw_actions-0.15.3.dist-info/entry_points.txt,sha256=c3Vrl8JrMg1-FkLKpEiMahoefkRBrFCFXDhX7a-OBfA,43
96
- dycw_actions-0.15.3.dist-info/METADATA,sha256=GVfrK4LD7qIn-vW-00zrN-muLSo-avf17X3jtO3g_QU,1585
97
- dycw_actions-0.15.3.dist-info/RECORD,,
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,,