Skip to content

Commit c29d559

Browse files
AAriamRepoDynamicsBot
authored andcommitted
refactor(auto): Apply automatic formatting and refactoring.
[skip ci]
1 parent b373495 commit c29d559

1 file changed

Lines changed: 151 additions & 30 deletions

File tree

.manager/src/pypackit/__main__.py

Lines changed: 151 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,65 +12,186 @@ def get_recursive(parts, current_object):
1212
return getattr(current_object, parts[0])
1313
else:
1414
return get_recursive(parts[1:], getattr(current_object, parts[0]))
15+
1516
parts = endpoint_name.split(".")
1617
return get_recursive(parts, script)
1718

1819
logger.initialize(realtime_levels=list(range(7)))
1920
# begin auto-generated parser
2021
parser = argparse.ArgumentParser(description="Project Manager CLI")
21-
parser.add_argument("--repo", type=str, help="Local path to the repository root directory.", default="./")
22+
parser.add_argument(
23+
"--repo", type=str, help="Local path to the repository root directory.", default="./"
24+
)
2225
# Sub-parsers for parser
2326
subparsers_main = parser.add_subparsers(dest="command", required=True)
24-
subparser_cca = subparsers_main.add_parser("cca", help="Run Continuous Configuration Automation on the repository.")
25-
subparser_cca.add_argument("-t", "--token", type=str, help="GitHub token for accessing the repository.")
26-
subparser_cca.add_argument("-b", "--branch-version", help="Branch-name to version mappings (e.g., -b main=0.0.0 dev=1.0.0a1) to use instead of git tags.", type=str, nargs="*", metavar="BRNACH=VERSION")
27-
subparser_cca.add_argument("-c", "--control-center", help="Path to the control center directory containing configuration files.", type=str)
28-
subparser_cca.add_argument("-d", "--dry-run", help="Perform a dry run without making any changes.", action="store_true")
29-
subparser_cca.add_argument("-n", "--no-validate", help="Skip validation of the metadata.json file.", dest="validate", action="store_false")
27+
subparser_cca = subparsers_main.add_parser(
28+
"cca", help="Run Continuous Configuration Automation on the repository."
29+
)
30+
subparser_cca.add_argument(
31+
"-t", "--token", type=str, help="GitHub token for accessing the repository."
32+
)
33+
subparser_cca.add_argument(
34+
"-b",
35+
"--branch-version",
36+
help="Branch-name to version mappings (e.g., -b main=0.0.0 dev=1.0.0a1) to use instead of git tags.",
37+
type=str,
38+
nargs="*",
39+
metavar="BRNACH=VERSION",
40+
)
41+
subparser_cca.add_argument(
42+
"-c",
43+
"--control-center",
44+
help="Path to the control center directory containing configuration files.",
45+
type=str,
46+
)
47+
subparser_cca.add_argument(
48+
"-d", "--dry-run", help="Perform a dry run without making any changes.", action="store_true"
49+
)
50+
subparser_cca.add_argument(
51+
"-n",
52+
"--no-validate",
53+
help="Skip validation of the metadata.json file.",
54+
dest="validate",
55+
action="store_false",
56+
)
3057
subparser_cca.set_defaults(endpoint="cca.run_cli")
31-
subparser_lint = subparsers_main.add_parser("lint", help="Run pre-commit hooks on the repository.")
32-
subparser_lint.add_argument("-x", "--action", help="Lint mode.", type=str, choices=['report', 'run', 'validate'], default="run")
33-
subparser_lint.add_argument("-c", "--config", help="Path to the pre-commit configuration file.", type=str, default=".devcontainer/config/pre-commit.yaml")
34-
subparser_lint.add_argument("-r2", "--to-ref", help="Run on files changed until the given git ref. This must be accompanied by --from-ref.")
58+
subparser_lint = subparsers_main.add_parser(
59+
"lint", help="Run pre-commit hooks on the repository."
60+
)
61+
subparser_lint.add_argument(
62+
"-x",
63+
"--action",
64+
help="Lint mode.",
65+
type=str,
66+
choices=["report", "run", "validate"],
67+
default="run",
68+
)
69+
subparser_lint.add_argument(
70+
"-c",
71+
"--config",
72+
help="Path to the pre-commit configuration file.",
73+
type=str,
74+
default=".devcontainer/config/pre-commit.yaml",
75+
)
76+
subparser_lint.add_argument(
77+
"-r2",
78+
"--to-ref",
79+
help="Run on files changed until the given git ref. This must be accompanied by --from-ref.",
80+
)
3581
subparser_lint_mutually_exclusive_hook = subparser_lint.add_mutually_exclusive_group()
36-
subparser_lint_mutually_exclusive_hook.add_argument("-i", "--hook-id", help="Specific hook ID to run. This will only run the specified hook.", type=str)
37-
subparser_lint_mutually_exclusive_hook.add_argument("-s", "--hook-stage", help="Specific hook stage to run. This will only run hooks in the specified stage.", type=str)
82+
subparser_lint_mutually_exclusive_hook.add_argument(
83+
"-i",
84+
"--hook-id",
85+
help="Specific hook ID to run. This will only run the specified hook.",
86+
type=str,
87+
)
88+
subparser_lint_mutually_exclusive_hook.add_argument(
89+
"-s",
90+
"--hook-stage",
91+
help="Specific hook stage to run. This will only run hooks in the specified stage.",
92+
type=str,
93+
)
3894
subparser_lint_mutually_exclusive_file = subparser_lint.add_mutually_exclusive_group()
39-
subparser_lint_mutually_exclusive_file.add_argument("-a", "--all-files", help="Run on all files in the repository.", action="store_true")
40-
subparser_lint_mutually_exclusive_file.add_argument("-f", "--files", help="Run on specific files.", nargs="+")
41-
subparser_lint_mutually_exclusive_file.add_argument("-r1", "--from-ref", help="Run on files changed since the given git ref. This must be accompanied by --to-ref.")
95+
subparser_lint_mutually_exclusive_file.add_argument(
96+
"-a", "--all-files", help="Run on all files in the repository.", action="store_true"
97+
)
98+
subparser_lint_mutually_exclusive_file.add_argument(
99+
"-f", "--files", help="Run on specific files.", nargs="+"
100+
)
101+
subparser_lint_mutually_exclusive_file.add_argument(
102+
"-r1",
103+
"--from-ref",
104+
help="Run on files changed since the given git ref. This must be accompanied by --to-ref.",
105+
)
42106
subparser_lint.set_defaults(endpoint="lint.run_cli")
43-
subparser_version = subparsers_main.add_parser("version", help="Print the current version of the project.")
107+
subparser_version = subparsers_main.add_parser(
108+
"version", help="Print the current version of the project."
109+
)
44110
subparser_version.set_defaults(endpoint="version.run_cli")
45111
subparser_build = subparsers_main.add_parser("build", help="Build project components.")
46112
# Sub-parsers for subparser_build
47113
subparsers_build = subparser_build.add_subparsers(dest="build", required=True)
48-
subparser_conda = subparsers_build.add_parser("conda", help="Build a conda package in the project.")
49-
subparser_conda.add_argument("-p", "--pkg", help="Package ID, i.e., the `pypkg_` key suffix in configuration files.", default="main")
50-
subparser_conda.add_argument("-o", "--output", help="Path to the local conda channel directory.", type=str, default=".local/temp/conda-channel")
51-
subparser_conda.add_argument("-r", "--recipe", help="Type of recipe to build.", type=str, choices=['local', 'global'], default="local")
52-
subparser_conda.add_argument("--args", help="Additional arguments to pass to the conda build command.", nargs=argparse.REMAINDER)
114+
subparser_conda = subparsers_build.add_parser(
115+
"conda", help="Build a conda package in the project."
116+
)
117+
subparser_conda.add_argument(
118+
"-p",
119+
"--pkg",
120+
help="Package ID, i.e., the `pypkg_` key suffix in configuration files.",
121+
default="main",
122+
)
123+
subparser_conda.add_argument(
124+
"-o",
125+
"--output",
126+
help="Path to the local conda channel directory.",
127+
type=str,
128+
default=".local/temp/conda-channel",
129+
)
130+
subparser_conda.add_argument(
131+
"-r",
132+
"--recipe",
133+
help="Type of recipe to build.",
134+
type=str,
135+
choices=["local", "global"],
136+
default="local",
137+
)
138+
subparser_conda.add_argument(
139+
"--args",
140+
help="Additional arguments to pass to the conda build command.",
141+
nargs=argparse.REMAINDER,
142+
)
53143
subparser_conda.set_defaults(endpoint="build.conda.run_cli")
54-
subparser_python = subparsers_build.add_parser("python", help="Build a Python package in the project.")
55-
subparser_python.add_argument("-p", "--pkg", help="Package ID, i.e., the `pypkg_` key suffix in configuration files.", default="main")
56-
subparser_python.add_argument("-o", "--output", help="Path to the local PyPI channel directory.", type=str, default=".local/temp/wheelhouse")
57-
subparser_python.add_argument("--args", help="Additional arguments to pass to the Python build command.", nargs=argparse.REMAINDER)
144+
subparser_python = subparsers_build.add_parser(
145+
"python", help="Build a Python package in the project."
146+
)
147+
subparser_python.add_argument(
148+
"-p",
149+
"--pkg",
150+
help="Package ID, i.e., the `pypkg_` key suffix in configuration files.",
151+
default="main",
152+
)
153+
subparser_python.add_argument(
154+
"-o",
155+
"--output",
156+
help="Path to the local PyPI channel directory.",
157+
type=str,
158+
default=".local/temp/wheelhouse",
159+
)
160+
subparser_python.add_argument(
161+
"--args",
162+
help="Additional arguments to pass to the Python build command.",
163+
nargs=argparse.REMAINDER,
164+
)
58165
subparser_python.set_defaults(endpoint="build.python.run_cli")
59166
subparser_render = subparsers_main.add_parser("render", help="Render documents in the project.")
60167
# Sub-parsers for subparser_render
61168
subparsers_render = subparser_render.add_subparsers(dest="render", required=True)
62-
subparser_pypi = subparsers_render.add_parser("pypi", help="Render package README file for PyPI.")
63-
subparser_pypi.add_argument("-p", "--pkg", help="Package ID, i.e., the `pypkg_` key suffix in configuration files.", default="main")
64-
subparser_pypi.add_argument("-o", "--output", help="Output directory to write the rendered HTML file.", type=str, default=".local/temp/readme-pypi")
169+
subparser_pypi = subparsers_render.add_parser(
170+
"pypi", help="Render package README file for PyPI."
171+
)
172+
subparser_pypi.add_argument(
173+
"-p",
174+
"--pkg",
175+
help="Package ID, i.e., the `pypkg_` key suffix in configuration files.",
176+
default="main",
177+
)
178+
subparser_pypi.add_argument(
179+
"-o",
180+
"--output",
181+
help="Output directory to write the rendered HTML file.",
182+
type=str,
183+
default=".local/temp/readme-pypi",
184+
)
65185
subparser_pypi.set_defaults(endpoint="render.pypi.run_cli")
66186
# Process inputs
67187
args = parser.parse_args()
68188
import json
69189
from pathlib import Path
190+
70191
setattr(
71192
args,
72193
"metadata",
73-
json.loads((Path(args.repo).resolve() / ".github/.repodynamics/metadata.json").read_text())
194+
json.loads((Path(args.repo).resolve() / ".github/.repodynamics/metadata.json").read_text()),
74195
)
75196
if args.command == "cca":
76197
if args.branch_version:

0 commit comments

Comments
 (0)