dycw-actions 0.3.2__py3-none-any.whl → 0.7.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.
Files changed (83) hide show
  1. actions/__init__.py +1 -1
  2. actions/action_dicts/constants.py +8 -0
  3. actions/action_dicts/lib.py +186 -0
  4. actions/clean_dir/cli.py +21 -0
  5. actions/clean_dir/constants.py +7 -0
  6. actions/clean_dir/lib.py +59 -0
  7. actions/clean_dir/settings.py +18 -0
  8. actions/cli.py +95 -6
  9. actions/constants.py +10 -0
  10. actions/pre_commit/click.py +15 -0
  11. actions/pre_commit/conformalize_repo/__init__.py +1 -0
  12. actions/pre_commit/conformalize_repo/cli.py +64 -0
  13. actions/pre_commit/conformalize_repo/configs/gitignore +244 -0
  14. actions/pre_commit/conformalize_repo/constants.py +78 -0
  15. actions/pre_commit/conformalize_repo/lib.py +1293 -0
  16. actions/pre_commit/conformalize_repo/settings.py +119 -0
  17. actions/pre_commit/constants.py +8 -0
  18. actions/pre_commit/format_requirements/__init__.py +1 -0
  19. actions/pre_commit/format_requirements/cli.py +24 -0
  20. actions/pre_commit/format_requirements/constants.py +7 -0
  21. actions/pre_commit/format_requirements/lib.py +52 -0
  22. actions/pre_commit/replace_sequence_strs/__init__.py +1 -0
  23. actions/pre_commit/replace_sequence_strs/cli.py +24 -0
  24. actions/pre_commit/replace_sequence_strs/constants.py +7 -0
  25. actions/pre_commit/replace_sequence_strs/lib.py +73 -0
  26. actions/pre_commit/touch_empty_py/__init__.py +1 -0
  27. actions/pre_commit/touch_empty_py/cli.py +24 -0
  28. actions/pre_commit/touch_empty_py/constants.py +7 -0
  29. actions/pre_commit/touch_empty_py/lib.py +54 -0
  30. actions/pre_commit/touch_py_typed/__init__.py +1 -0
  31. actions/pre_commit/touch_py_typed/cli.py +24 -0
  32. actions/pre_commit/touch_py_typed/constants.py +7 -0
  33. actions/pre_commit/touch_py_typed/lib.py +64 -0
  34. actions/pre_commit/update_requirements/__init__.py +1 -0
  35. actions/pre_commit/update_requirements/classes.py +117 -0
  36. actions/pre_commit/update_requirements/cli.py +24 -0
  37. actions/pre_commit/update_requirements/constants.py +7 -0
  38. actions/pre_commit/update_requirements/lib.py +128 -0
  39. actions/pre_commit/utilities.py +386 -0
  40. actions/publish_package/__init__.py +1 -0
  41. actions/publish_package/cli.py +27 -0
  42. actions/publish_package/constants.py +7 -0
  43. actions/{publish → publish_package}/lib.py +18 -17
  44. actions/{publish → publish_package}/settings.py +7 -7
  45. actions/py.typed +0 -0
  46. actions/random_sleep/__init__.py +1 -0
  47. actions/random_sleep/cli.py +26 -0
  48. actions/random_sleep/constants.py +7 -0
  49. actions/{sleep → random_sleep}/lib.py +14 -13
  50. actions/{sleep → random_sleep}/settings.py +3 -3
  51. actions/run_hooks/__init__.py +1 -0
  52. actions/run_hooks/cli.py +21 -0
  53. actions/run_hooks/constants.py +7 -0
  54. actions/run_hooks/lib.py +97 -0
  55. actions/run_hooks/settings.py +24 -0
  56. actions/setup_cronjob/__init__.py +1 -0
  57. actions/setup_cronjob/cli.py +31 -0
  58. actions/setup_cronjob/configs/cron.tmpl +3 -0
  59. actions/setup_cronjob/configs/logrotate.tmpl +10 -0
  60. actions/setup_cronjob/constants.py +12 -0
  61. actions/setup_cronjob/lib.py +120 -0
  62. actions/setup_cronjob/settings.py +27 -0
  63. actions/tag_commit/__init__.py +1 -0
  64. actions/tag_commit/cli.py +27 -0
  65. actions/tag_commit/constants.py +7 -0
  66. actions/tag_commit/lib.py +63 -0
  67. actions/{tag → tag_commit}/settings.py +3 -3
  68. actions/types.py +14 -1
  69. actions/utilities.py +131 -17
  70. dycw_actions-0.7.1.dist-info/METADATA +22 -0
  71. dycw_actions-0.7.1.dist-info/RECORD +77 -0
  72. {dycw_actions-0.3.2.dist-info → dycw_actions-0.7.1.dist-info}/WHEEL +1 -1
  73. actions/publish/cli.py +0 -43
  74. actions/settings.py +0 -18
  75. actions/sleep/cli.py +0 -39
  76. actions/tag/cli.py +0 -43
  77. actions/tag/lib.py +0 -62
  78. dycw_actions-0.3.2.dist-info/METADATA +0 -14
  79. dycw_actions-0.3.2.dist-info/RECORD +0 -22
  80. /actions/{publish → action_dicts}/__init__.py +0 -0
  81. /actions/{sleep → clean_dir}/__init__.py +0 -0
  82. /actions/{tag → pre_commit}/__init__.py +0 -0
  83. {dycw_actions-0.3.2.dist-info → dycw_actions-0.7.1.dist-info}/entry_points.txt +0 -0
actions/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  from __future__ import annotations
2
2
 
3
- __version__ = "0.3.2"
3
+ __version__ = "0.7.1"
@@ -0,0 +1,8 @@
1
+ from __future__ import annotations
2
+
3
+ GITHUB_TOKEN = "${{github.token}}" # noqa: S105
4
+ PRERELEASE = "disallow"
5
+ RESOLUTION = "highest"
6
+
7
+
8
+ __all__ = ["GITHUB_TOKEN", "PRERELEASE", "RESOLUTION"]
@@ -0,0 +1,186 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING, Any
4
+
5
+ from actions.action_dicts.constants import GITHUB_TOKEN, PRERELEASE, RESOLUTION
6
+ from actions.publish_package.constants import PUBLISH_PACKAGE_DOCSTRING
7
+ from actions.random_sleep.constants import RANDOM_SLEEP_DOCSTRING
8
+ from actions.run_hooks.constants import RUN_HOOKS_DOCSTRING
9
+ from actions.tag_commit.constants import TAG_COMMIT_DOCSTRING
10
+
11
+ if TYPE_CHECKING:
12
+ from actions.types import StrDict
13
+
14
+
15
+ def run_action_pre_commit_dict(
16
+ *,
17
+ token: str = GITHUB_TOKEN,
18
+ submodules: str | None = None,
19
+ repos: Any | None = None,
20
+ hooks: Any | None = None,
21
+ sleep: int = 1,
22
+ gitea: bool = False,
23
+ ) -> StrDict:
24
+ dict_: StrDict = {"token": token}
25
+ _add_item(dict_, "submodules", value=submodules)
26
+ _add_item(dict_, "repos", value=repos)
27
+ _add_item(dict_, "hooks", value=hooks)
28
+ dict_["sleep"] = sleep
29
+ return {
30
+ "if": f"{_runner(gitea=gitea)}.event_name == 'pull_request'",
31
+ "name": RUN_HOOKS_DOCSTRING,
32
+ "uses": "dycw/action-run-hooks@latest",
33
+ "with": dict_,
34
+ }
35
+
36
+
37
+ def run_action_publish_dict(
38
+ *,
39
+ token: str = GITHUB_TOKEN,
40
+ username: str | None = None,
41
+ password: str | None = None,
42
+ publish_url: str | None = None,
43
+ trusted_publishing: bool = False,
44
+ native_tls: bool = False,
45
+ ) -> StrDict:
46
+ dict_: StrDict = {"token": token}
47
+ _add_item(dict_, "username", value=username)
48
+ _add_item(dict_, "password", value=password)
49
+ _add_item(dict_, "publish-url", value=publish_url)
50
+ _add_boolean(dict_, "trusted-publishing", value=trusted_publishing)
51
+ _add_native_tls(dict_, native_tls=native_tls)
52
+ return {
53
+ "name": PUBLISH_PACKAGE_DOCSTRING,
54
+ "uses": "dycw/action-publish-package@latest",
55
+ "with": dict_,
56
+ }
57
+
58
+
59
+ def run_action_pyright_dict(
60
+ *,
61
+ token: str = GITHUB_TOKEN,
62
+ python_version: str | None = None,
63
+ resolution: str = RESOLUTION,
64
+ prerelease: str = PRERELEASE,
65
+ native_tls: bool = False,
66
+ with_requirements: str | None = None,
67
+ ) -> StrDict:
68
+ dict_: StrDict = {"token": token}
69
+ _add_python_version(dict_, python_version=python_version)
70
+ dict_["resolution"] = resolution
71
+ dict_["prerelease"] = prerelease
72
+ _add_native_tls(dict_, native_tls=native_tls)
73
+ _add_with_requirements(dict_, with_requirements=with_requirements)
74
+ return {
75
+ "name": "Run 'pyright'",
76
+ "uses": "dycw/action-pyright@latest",
77
+ "with": dict_,
78
+ }
79
+
80
+
81
+ def run_action_pytest_dict(
82
+ *,
83
+ token: str = GITHUB_TOKEN,
84
+ python_version: str | None = None,
85
+ sops_age_key: str | None = None,
86
+ resolution: str = RESOLUTION,
87
+ prerelease: str = PRERELEASE,
88
+ native_tls: bool = False,
89
+ with_requirements: str | None = None,
90
+ ) -> StrDict:
91
+ dict_: StrDict = {"token": token}
92
+ _add_python_version(dict_, python_version=python_version)
93
+ _add_item(dict_, "sops-age-key", value=sops_age_key)
94
+ dict_["resolution"] = resolution
95
+ dict_["prerelease"] = prerelease
96
+ _add_native_tls(dict_, native_tls=native_tls)
97
+ _add_with_requirements(dict_, with_requirements=with_requirements)
98
+ return {"name": "Run 'pytest'", "uses": "dycw/action-pytest@latest", "with": dict_}
99
+
100
+
101
+ def run_action_random_sleep_dict(
102
+ *,
103
+ token: str = GITHUB_TOKEN,
104
+ min: int = 0, # noqa: A002
105
+ max: int = 3600, # noqa: A002
106
+ step: int = 1,
107
+ log_freq: int = 1,
108
+ ) -> StrDict:
109
+ dict_: StrDict = {
110
+ "token": token,
111
+ "min": min,
112
+ "max": max,
113
+ "step": step,
114
+ "log-freq": log_freq,
115
+ }
116
+ return {
117
+ "name": RANDOM_SLEEP_DOCSTRING,
118
+ "uses": "dycw/action-random-sleep@latest",
119
+ "with": dict_,
120
+ }
121
+
122
+
123
+ def run_action_ruff_dict(*, token: str = GITHUB_TOKEN) -> StrDict:
124
+ dict_: StrDict = {"token": token}
125
+ return {"name": "Run 'ruff'", "uses": "dycw/action-ruff@latest", "with": dict_}
126
+
127
+
128
+ def run_action_tag_dict(
129
+ *,
130
+ token: str = GITHUB_TOKEN,
131
+ user_name: str = "github-actions-bot",
132
+ user_email: str = "noreply@github.com",
133
+ major_minor: bool = False,
134
+ major: bool = False,
135
+ latest: bool = False,
136
+ ) -> StrDict:
137
+ dict_: StrDict = {"token": token, "user-name": user_name, "user-email": user_email}
138
+ _add_boolean(dict_, "major-minor", value=major_minor)
139
+ _add_boolean(dict_, "major", value=major)
140
+ _add_boolean(dict_, "latest", value=latest)
141
+ return {
142
+ "name": TAG_COMMIT_DOCSTRING,
143
+ "uses": "dycw/action-tag-commit@latest",
144
+ "with": dict_,
145
+ }
146
+
147
+
148
+ def _add_boolean(dict_: StrDict, key: str, /, *, value: bool = False) -> None:
149
+ if value:
150
+ dict_[key] = value
151
+
152
+
153
+ def _add_item(dict_: StrDict, key: str, /, *, value: Any | None = None) -> None:
154
+ if value is not None:
155
+ dict_[key] = value
156
+
157
+
158
+ def _add_native_tls(dict_: StrDict, /, *, native_tls: bool = False) -> None:
159
+ _add_boolean(dict_, "native-tls", value=native_tls)
160
+
161
+
162
+ def _add_python_version(
163
+ dict_: StrDict, /, *, python_version: str | None = None
164
+ ) -> None:
165
+ _add_item(dict_, "python-version", value=python_version)
166
+
167
+
168
+ def _add_with_requirements(
169
+ dict_: StrDict, /, *, with_requirements: str | None = None
170
+ ) -> None:
171
+ _add_item(dict_, "with-requirements", value=with_requirements)
172
+
173
+
174
+ def _runner(*, gitea: bool = False) -> str:
175
+ return "gitea" if gitea else "github"
176
+
177
+
178
+ __all__ = [
179
+ "run_action_pre_commit_dict",
180
+ "run_action_publish_dict",
181
+ "run_action_pyright_dict",
182
+ "run_action_pytest_dict",
183
+ "run_action_random_sleep_dict",
184
+ "run_action_ruff_dict",
185
+ "run_action_tag_dict",
186
+ ]
@@ -0,0 +1,21 @@
1
+ from __future__ import annotations
2
+
3
+ from typed_settings import click_options
4
+ from utilities.logging import basic_config
5
+ from utilities.os import is_pytest
6
+
7
+ from actions.clean_dir.lib import clean_dir
8
+ from actions.clean_dir.settings import Settings
9
+ from actions.logging import LOGGER
10
+ from actions.utilities import LOADER
11
+
12
+
13
+ @click_options(Settings, [LOADER], show_envvars_in_help=True)
14
+ def clean_dir_sub_cmd(settings: Settings, /) -> None:
15
+ if is_pytest():
16
+ return
17
+ basic_config(obj=LOGGER)
18
+ clean_dir(dir_=settings.dir)
19
+
20
+
21
+ __all__ = ["clean_dir_sub_cmd"]
@@ -0,0 +1,7 @@
1
+ from __future__ import annotations
2
+
3
+ CLEAN_DIR_DOCSTRING = "Clean a directory"
4
+ CLEAN_DIR_SUB_CMD = "clean-dir"
5
+
6
+
7
+ __all__ = ["CLEAN_DIR_DOCSTRING", "CLEAN_DIR_SUB_CMD"]
@@ -0,0 +1,59 @@
1
+ from __future__ import annotations
2
+
3
+ from pathlib import Path
4
+ from shutil import rmtree
5
+ from typing import TYPE_CHECKING
6
+
7
+ from utilities.text import strip_and_dedent
8
+
9
+ from actions import __version__
10
+ from actions.clean_dir.settings import SETTINGS
11
+ from actions.logging import LOGGER
12
+
13
+ if TYPE_CHECKING:
14
+ from collections.abc import Iterator
15
+
16
+ from utilities.types import PathLike
17
+
18
+
19
+ def clean_dir(*, dir_: PathLike = SETTINGS.dir) -> None:
20
+ LOGGER.info(
21
+ strip_and_dedent("""
22
+ Running '%s' (version %s) with settings:
23
+ - dir = %s
24
+ """),
25
+ clean_dir.__name__,
26
+ __version__,
27
+ dir_,
28
+ )
29
+ dir_ = Path(dir_)
30
+ if not dir_.is_dir():
31
+ msg = f"{str(dir_)!r} is a not a directory"
32
+ raise NotADirectoryError(msg)
33
+ while True:
34
+ files = list(_yield_files(dir_=dir_))
35
+ if len(files) >= 1:
36
+ for f in files:
37
+ f.unlink(missing_ok=True)
38
+ dirs = list(_yield_dirs(dir_=dir_))
39
+ if len(dirs) >= 1:
40
+ for d in dirs:
41
+ rmtree(d, ignore_errors=True)
42
+ else:
43
+ LOGGER.info("Finished cleaning %r", str(dir_))
44
+ return
45
+
46
+
47
+ def _yield_dirs(*, dir_: PathLike = SETTINGS.dir) -> Iterator[Path]:
48
+ for path in Path(dir_).rglob("**/*"):
49
+ if path.is_dir() and (len(list(path.iterdir())) == 0):
50
+ yield path
51
+
52
+
53
+ def _yield_files(*, dir_: PathLike = SETTINGS.dir) -> Iterator[Path]:
54
+ dir_ = Path(dir_)
55
+ yield from dir_.rglob("**/*.pyc")
56
+ yield from dir_.rglob("**/*.pyo")
57
+
58
+
59
+ __all__ = ["clean_dir"]
@@ -0,0 +1,18 @@
1
+ from __future__ import annotations
2
+
3
+ from pathlib import Path
4
+
5
+ from typed_settings import load_settings, option, settings
6
+
7
+ from actions.utilities import LOADER
8
+
9
+
10
+ @settings
11
+ class Settings:
12
+ dir: Path = option(default=Path.cwd(), help="The directory to clean")
13
+
14
+
15
+ SETTINGS = load_settings(Settings, [LOADER])
16
+
17
+
18
+ __all__ = ["SETTINGS", "Settings"]
actions/cli.py CHANGED
@@ -3,19 +3,108 @@ from __future__ import annotations
3
3
  from click import group
4
4
  from utilities.click import CONTEXT_SETTINGS
5
5
 
6
- from actions.publish.cli import publish_sub_cmd
7
- from actions.sleep.cli import sleep_sub_cmd
8
- from actions.tag.cli import tag_sub_cmd
6
+ from actions.clean_dir.cli import clean_dir_sub_cmd
7
+ from actions.clean_dir.constants import CLEAN_DIR_SUB_CMD
8
+ from actions.pre_commit.conformalize_repo.cli import conformalize_repo_sub_cmd
9
+ from actions.pre_commit.conformalize_repo.constants import (
10
+ CONFORMALIZE_REPO_DOCSTRING,
11
+ CONFORMALIZE_REPO_SUB_CMD,
12
+ )
13
+ from actions.pre_commit.format_requirements.cli import format_requirements_sub_cmd
14
+ from actions.pre_commit.format_requirements.constants import (
15
+ FORMAT_REQUIREMENTS_DOCSTRING,
16
+ FORMAT_REQUIREMENTS_SUB_CMD,
17
+ )
18
+ from actions.pre_commit.replace_sequence_strs.cli import replace_sequence_strs_sub_cmd
19
+ from actions.pre_commit.replace_sequence_strs.constants import (
20
+ REPLACE_SEQUENCE_STRS_DOCSTRING,
21
+ REPLACE_SEQUENCE_STRS_SUB_CMD,
22
+ )
23
+ from actions.pre_commit.touch_empty_py.cli import touch_empty_py_sub_cmd
24
+ from actions.pre_commit.touch_empty_py.constants import (
25
+ TOUCH_EMPTY_PY_DOCSTRING,
26
+ TOUCH_EMPTY_PY_SUB_CMD,
27
+ )
28
+ from actions.pre_commit.touch_py_typed.cli import touch_py_typed_sub_cmd
29
+ from actions.pre_commit.touch_py_typed.constants import (
30
+ TOUCH_PY_TYPED_DOCSTRING,
31
+ TOUCH_PY_TYPED_SUB_CMD,
32
+ )
33
+ from actions.pre_commit.update_requirements.cli import update_requirements_sub_cmd
34
+ from actions.pre_commit.update_requirements.constants import (
35
+ UPDATE_REQUIREMENTS_DOCSTRING,
36
+ UPDATE_REQUIREMENTS_SUB_CMD,
37
+ )
38
+ from actions.publish_package.cli import publish_package_sub_cmd
39
+ from actions.publish_package.constants import (
40
+ PUBLISH_PACKAGE_DOCSTRING,
41
+ PUBLISH_PACKAGE_SUB_CMD,
42
+ )
43
+ from actions.random_sleep.cli import random_sleep_sub_cmd
44
+ from actions.random_sleep.constants import RANDOM_SLEEP_DOCSTRING, RANDOM_SLEEP_SUB_CMD
45
+ from actions.run_hooks.cli import run_hooks_sub_cmd
46
+ from actions.run_hooks.constants import RUN_HOOKS_DOCSTRING, RUN_HOOKS_SUB_CMD
47
+ from actions.setup_cronjob.cli import setup_cronjob_sub_cmd
48
+ from actions.setup_cronjob.constants import (
49
+ SETUP_CRONJOB_DOCSTRING,
50
+ SETUP_CRONJOB_SUB_CMD,
51
+ )
52
+ from actions.tag_commit.cli import tag_commit_sub_cmd
53
+ from actions.tag_commit.constants import TAG_COMMIT_DOCSTRING, TAG_COMMIT_SUB_CMD
9
54
 
10
55
 
11
56
  @group(**CONTEXT_SETTINGS)
12
57
  def _main() -> None: ...
13
58
 
14
59
 
15
- _ = _main.command(name="publish", **CONTEXT_SETTINGS)(publish_sub_cmd)
16
- _ = _main.command(name="sleep", **CONTEXT_SETTINGS)(sleep_sub_cmd)
17
- _ = _main.command(name="tag", **CONTEXT_SETTINGS)(tag_sub_cmd)
60
+ _ = _main.command(name=CLEAN_DIR_SUB_CMD, help=CLEAN_DIR_SUB_CMD, **CONTEXT_SETTINGS)(
61
+ clean_dir_sub_cmd
62
+ )
63
+ _ = _main.command(
64
+ name=PUBLISH_PACKAGE_SUB_CMD, help=PUBLISH_PACKAGE_DOCSTRING, **CONTEXT_SETTINGS
65
+ )(publish_package_sub_cmd)
66
+ _ = _main.command(name=RUN_HOOKS_SUB_CMD, help=RUN_HOOKS_DOCSTRING, **CONTEXT_SETTINGS)(
67
+ run_hooks_sub_cmd
68
+ )
69
+ _ = _main.command(
70
+ name=RANDOM_SLEEP_SUB_CMD, help=RANDOM_SLEEP_DOCSTRING, **CONTEXT_SETTINGS
71
+ )(random_sleep_sub_cmd)
72
+ _ = _main.command(
73
+ name=SETUP_CRONJOB_SUB_CMD, help=SETUP_CRONJOB_DOCSTRING, **CONTEXT_SETTINGS
74
+ )(setup_cronjob_sub_cmd)
75
+ _ = _main.command(
76
+ name=TAG_COMMIT_SUB_CMD, help=TAG_COMMIT_DOCSTRING, **CONTEXT_SETTINGS
77
+ )(tag_commit_sub_cmd)
18
78
 
19
79
 
80
+ @_main.group(name="pre-commit", help="Pre-commit hooks", **CONTEXT_SETTINGS)
81
+ def pre_commit_sub_cmd() -> None: ...
82
+
83
+
84
+ _ = pre_commit_sub_cmd.command(
85
+ name=CONFORMALIZE_REPO_SUB_CMD, help=CONFORMALIZE_REPO_DOCSTRING, **CONTEXT_SETTINGS
86
+ )(conformalize_repo_sub_cmd)
87
+ _ = pre_commit_sub_cmd.command(
88
+ name=FORMAT_REQUIREMENTS_SUB_CMD,
89
+ help=FORMAT_REQUIREMENTS_DOCSTRING,
90
+ **CONTEXT_SETTINGS,
91
+ )(format_requirements_sub_cmd)
92
+ _ = pre_commit_sub_cmd.command(
93
+ name=REPLACE_SEQUENCE_STRS_SUB_CMD,
94
+ help=REPLACE_SEQUENCE_STRS_DOCSTRING,
95
+ **CONTEXT_SETTINGS,
96
+ )(replace_sequence_strs_sub_cmd)
97
+ _ = pre_commit_sub_cmd.command(
98
+ name=TOUCH_EMPTY_PY_SUB_CMD, help=TOUCH_EMPTY_PY_DOCSTRING, **CONTEXT_SETTINGS
99
+ )(touch_empty_py_sub_cmd)
100
+ _ = pre_commit_sub_cmd.command(
101
+ name=TOUCH_PY_TYPED_SUB_CMD, help=TOUCH_PY_TYPED_DOCSTRING, **CONTEXT_SETTINGS
102
+ )(touch_py_typed_sub_cmd)
103
+ _ = pre_commit_sub_cmd.command(
104
+ name=UPDATE_REQUIREMENTS_SUB_CMD,
105
+ help=UPDATE_REQUIREMENTS_DOCSTRING,
106
+ **CONTEXT_SETTINGS,
107
+ )(update_requirements_sub_cmd)
108
+
20
109
  if __name__ == "__main__":
21
110
  _main()
actions/constants.py ADDED
@@ -0,0 +1,10 @@
1
+ from __future__ import annotations
2
+
3
+ from ruamel.yaml import YAML
4
+ from utilities.importlib import files
5
+
6
+ PATH_ACTIONS = files(anchor="actions")
7
+ YAML_INSTANCE = YAML()
8
+
9
+
10
+ __all__ = ["PATH_ACTIONS", "YAML_INSTANCE"]
@@ -0,0 +1,15 @@
1
+ from __future__ import annotations
2
+
3
+ from pathlib import Path
4
+
5
+ import click
6
+ from click import argument
7
+
8
+ path_argument = argument(
9
+ "paths",
10
+ nargs=-1,
11
+ type=click.Path(exists=True, file_okay=True, dir_okay=False, path_type=Path),
12
+ )
13
+
14
+
15
+ __all__ = ["path_argument"]
@@ -0,0 +1 @@
1
+ from __future__ import annotations
@@ -0,0 +1,64 @@
1
+ from __future__ import annotations
2
+
3
+ from typed_settings import click_options
4
+ from utilities.logging import basic_config
5
+ from utilities.os import is_pytest
6
+
7
+ from actions.logging import LOGGER
8
+ from actions.pre_commit.conformalize_repo.lib import conformalize_repo
9
+ from actions.pre_commit.conformalize_repo.settings import Settings
10
+ from actions.utilities import LOADER
11
+
12
+
13
+ @click_options(Settings, [LOADER], show_envvars_in_help=True)
14
+ def conformalize_repo_sub_cmd(settings: Settings, /) -> None:
15
+ if is_pytest():
16
+ return
17
+ basic_config(obj=LOGGER)
18
+ conformalize_repo(
19
+ coverage=settings.coverage,
20
+ description=settings.description,
21
+ envrc=settings.envrc,
22
+ envrc__uv=settings.envrc__uv,
23
+ envrc__uv__native_tls=settings.envrc__uv__native_tls,
24
+ github__pull_request__pre_commit=settings.github__pull_request__pre_commit,
25
+ github__pull_request__pre_commit__gitea=settings.github__pull_request__pre_commit__gitea,
26
+ github__pull_request__pyright=settings.github__pull_request__pyright,
27
+ github__pull_request__pytest__macos=settings.github__pull_request__pytest__macos,
28
+ github__pull_request__pytest__ubuntu=settings.github__pull_request__pytest__ubuntu,
29
+ github__pull_request__pytest__windows=settings.github__pull_request__pytest__windows,
30
+ github__pull_request__ruff=settings.github__pull_request__ruff,
31
+ github__push__publish=settings.github__push__publish,
32
+ github__push__tag=settings.github__push__tag,
33
+ github__push__tag__major=settings.github__push__tag__major,
34
+ github__push__tag__major_minor=settings.github__push__tag__major_minor,
35
+ github__push__tag__latest=settings.github__push__tag__latest,
36
+ gitignore=settings.gitignore,
37
+ package_name=settings.package_name,
38
+ pre_commit__dockerfmt=settings.pre_commit__dockerfmt,
39
+ pre_commit__prettier=settings.pre_commit__prettier,
40
+ pre_commit__python=settings.pre_commit__python,
41
+ pre_commit__ruff=settings.pre_commit__ruff,
42
+ pre_commit__shell=settings.pre_commit__shell,
43
+ pre_commit__taplo=settings.pre_commit__taplo,
44
+ pre_commit__uv=settings.pre_commit__uv,
45
+ pre_commit__uv__script=settings.pre_commit__uv__script,
46
+ pyproject=settings.pyproject,
47
+ pyproject__project__optional_dependencies__scripts=settings.pyproject__project__optional_dependencies__scripts,
48
+ pyproject__tool__uv__indexes=settings.pyproject__tool__uv__indexes,
49
+ pyright=settings.pyright,
50
+ pytest=settings.pytest,
51
+ pytest__asyncio=settings.pytest__asyncio,
52
+ pytest__ignore_warnings=settings.pytest__ignore_warnings,
53
+ pytest__timeout=settings.pytest__timeout,
54
+ python_package_name=settings.python_package_name,
55
+ python_version=settings.python_version,
56
+ readme=settings.readme,
57
+ repo_name=settings.repo_name,
58
+ ruff=settings.ruff,
59
+ run_version_bump=settings.run_version_bump,
60
+ script=settings.script,
61
+ )
62
+
63
+
64
+ __all__ = ["conformalize_repo_sub_cmd"]