apexcodexpy 0.2.1__tar.gz → 0.2.3__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.
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.3}/PKG-INFO +1 -1
- apexcodexpy-0.2.3/codex/runner.py +7 -0
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.3}/codex/service.py +72 -40
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.3}/codex/tasks/result.py +11 -2
- apexcodexpy-0.2.3/codex/typer/__init__.py +7 -0
- apexcodexpy-0.2.1/codex/cli.py → apexcodexpy-0.2.3/codex/typer/root.py +192 -255
- apexcodexpy-0.2.3/codex/typer/testing.py +94 -0
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.3}/pyproject.toml +2 -2
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.3}/LICENSE +0 -0
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.3}/README.md +0 -0
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.3}/codex/__init__.py +0 -0
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.3}/codex/reporters.py +0 -0
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.3}/codex/tasks/__init__.py +0 -0
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.3}/codex/tasks/dependabot.py +0 -0
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.3}/codex/tasks/update.py +0 -0
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.3}/codex/tools.py +0 -0
|
@@ -8,34 +8,14 @@ from codex.tasks import ComboResult, DependabotYaml, PyProjectToml, TaskResult
|
|
|
8
8
|
from codex.tools import MyPy, Pip, Poetry, Program, Ruff
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
@dataclass(frozen=True)
|
|
12
|
-
class CiMode:
|
|
13
|
-
codex: Codex
|
|
14
|
-
|
|
15
|
-
def lint(self) -> TaskResult:
|
|
16
|
-
return (
|
|
17
|
-
ComboResult()
|
|
18
|
-
.attach(install=self.codex.install())
|
|
19
|
-
.attach(lint=self.codex.lint())
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
def test(self) -> TaskResult:
|
|
23
|
-
return (
|
|
24
|
-
ComboResult()
|
|
25
|
-
.attach(install=self.codex.install())
|
|
26
|
-
.attach(pytest=Poetry().run(Pytest.on(self.codex.target).run()))
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
11
|
@dataclass(frozen=True)
|
|
31
12
|
class Codex:
|
|
32
13
|
target: Path
|
|
33
14
|
|
|
34
|
-
|
|
35
|
-
if on:
|
|
36
|
-
return CiMode(self)
|
|
15
|
+
in_ci: bool = False
|
|
37
16
|
|
|
38
|
-
|
|
17
|
+
def ci(self, on: bool) -> Codex:
|
|
18
|
+
return Codex(self.target, in_ci=on)
|
|
39
19
|
|
|
40
20
|
def sync(self, dry_run: bool = False) -> TaskResult:
|
|
41
21
|
return (
|
|
@@ -45,10 +25,17 @@ class Codex:
|
|
|
45
25
|
)
|
|
46
26
|
|
|
47
27
|
def install(self) -> TaskResult:
|
|
28
|
+
return self._install(when=True)
|
|
29
|
+
|
|
30
|
+
def _install(self, when: bool) -> ComboResult:
|
|
48
31
|
return (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
32
|
+
(
|
|
33
|
+
ComboResult()
|
|
34
|
+
.attach(tools=Pip().install("pip", "poetry"))
|
|
35
|
+
.attach(dependencies=Poetry().install())
|
|
36
|
+
)
|
|
37
|
+
if when
|
|
38
|
+
else ComboResult()
|
|
52
39
|
)
|
|
53
40
|
|
|
54
41
|
def lock(self) -> TaskResult:
|
|
@@ -59,7 +46,7 @@ class Codex:
|
|
|
59
46
|
|
|
60
47
|
def lint(self) -> TaskResult:
|
|
61
48
|
return (
|
|
62
|
-
|
|
49
|
+
self._install(when=self.in_ci)
|
|
63
50
|
.attach(poetry=Poetry().lint(self.target))
|
|
64
51
|
.attach(black=Poetry().run(Ruff(on=self.target).format().flag(check=True)))
|
|
65
52
|
.attach(ruff=Poetry().run(Ruff(on=self.target).lint()))
|
|
@@ -78,21 +65,16 @@ class Codex:
|
|
|
78
65
|
)
|
|
79
66
|
|
|
80
67
|
def test(self) -> TaskResult:
|
|
81
|
-
return
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
)
|
|
68
|
+
return self._install(when=self.in_ci).attach(self.test_unit())
|
|
69
|
+
|
|
70
|
+
def test_unit(self) -> TaskResult:
|
|
71
|
+
return CodexTest(self.target).ci(on=self.in_ci).unit()
|
|
72
|
+
|
|
73
|
+
def test_integration(self) -> TaskResult:
|
|
74
|
+
return CodexTest(self.target).integration()
|
|
89
75
|
|
|
90
76
|
def test_behaviour(self) -> TaskResult:
|
|
91
|
-
return
|
|
92
|
-
behave=Poetry().run(
|
|
93
|
-
Program("behave").append(self.target / "tests" / "features")
|
|
94
|
-
)
|
|
95
|
-
)
|
|
77
|
+
return CodexTest(self.target).behaviour()
|
|
96
78
|
|
|
97
79
|
def build(self, tag: str) -> TaskResult:
|
|
98
80
|
return (
|
|
@@ -121,6 +103,56 @@ class Codex:
|
|
|
121
103
|
)
|
|
122
104
|
|
|
123
105
|
|
|
106
|
+
@dataclass(frozen=True)
|
|
107
|
+
class CodexTest:
|
|
108
|
+
target: Path
|
|
109
|
+
|
|
110
|
+
in_ci: bool = False
|
|
111
|
+
|
|
112
|
+
def ci(self, on: bool = False) -> CodexTest:
|
|
113
|
+
return CodexTest(self.target, in_ci=on)
|
|
114
|
+
|
|
115
|
+
def unit(self) -> TaskResult:
|
|
116
|
+
return ComboResult().attach(
|
|
117
|
+
pytest=Poetry().run(
|
|
118
|
+
Pytest.on(self.target).run(
|
|
119
|
+
with_coverage=self._when_not_in_ci(),
|
|
120
|
+
last_failed=self._when_not_in_ci(),
|
|
121
|
+
)
|
|
122
|
+
)
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
def _when_not_in_ci(self) -> bool | None:
|
|
126
|
+
return None if self.in_ci else True
|
|
127
|
+
|
|
128
|
+
def integration(self) -> TaskResult:
|
|
129
|
+
return (
|
|
130
|
+
ComboResult()
|
|
131
|
+
.attach(
|
|
132
|
+
setup=(
|
|
133
|
+
ComboResult()
|
|
134
|
+
.attach(tools=Pip().install("poetry", "poetry-plugin-export"))
|
|
135
|
+
.attach(export=Poetry().export(self.target))
|
|
136
|
+
)
|
|
137
|
+
)
|
|
138
|
+
.attach(
|
|
139
|
+
pytest=Poetry().run(
|
|
140
|
+
Pytest.on(self.target / "tests" / "integration").run()
|
|
141
|
+
)
|
|
142
|
+
)
|
|
143
|
+
.attach(
|
|
144
|
+
teardown=Program("rm").append(self.target / "requirements.txt").run()
|
|
145
|
+
)
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
def behaviour(self) -> TaskResult:
|
|
149
|
+
return ComboResult().attach(
|
|
150
|
+
behave=Poetry().run(
|
|
151
|
+
Program("behave").append(self.target / "tests" / "features")
|
|
152
|
+
)
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
|
|
124
156
|
@dataclass(frozen=True)
|
|
125
157
|
class Pytest:
|
|
126
158
|
target: Path | None = None
|
|
@@ -37,10 +37,19 @@ class ComboResult:
|
|
|
37
37
|
|
|
38
38
|
def attach(self, *args: TaskResult, **kwargs: TaskResult) -> ComboResult:
|
|
39
39
|
for name, result in kwargs.items():
|
|
40
|
-
self.
|
|
40
|
+
self._attach_one(result.named(name))
|
|
41
41
|
|
|
42
42
|
for result in args:
|
|
43
|
-
self.
|
|
43
|
+
self._attach_one(result)
|
|
44
|
+
|
|
45
|
+
return self
|
|
46
|
+
|
|
47
|
+
def _attach_one(self, result: TaskResult) -> ComboResult:
|
|
48
|
+
match result:
|
|
49
|
+
case ComboResult():
|
|
50
|
+
self.results.extend(result.results)
|
|
51
|
+
case _:
|
|
52
|
+
self.results.append(result)
|
|
44
53
|
|
|
45
54
|
return self
|
|
46
55
|
|
|
@@ -1,255 +1,192 @@
|
|
|
1
|
-
from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
)
|
|
133
|
-
(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
)
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
"--
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
)
|
|
166
|
-
(
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
.
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
@
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
@test_cli.command(
|
|
196
|
-
name="unit",
|
|
197
|
-
help="Run programmer tests.",
|
|
198
|
-
)
|
|
199
|
-
def run_unit_tests(
|
|
200
|
-
path: str = typer.Option(
|
|
201
|
-
".",
|
|
202
|
-
"--path",
|
|
203
|
-
"-p",
|
|
204
|
-
help="Target directory.",
|
|
205
|
-
),
|
|
206
|
-
ci: bool = typer.Option(
|
|
207
|
-
False,
|
|
208
|
-
"--ci",
|
|
209
|
-
help="Run in CI mode.",
|
|
210
|
-
),
|
|
211
|
-
) -> None:
|
|
212
|
-
(
|
|
213
|
-
Codex(target=Path(path))
|
|
214
|
-
.ci(on=ci)
|
|
215
|
-
.test()
|
|
216
|
-
.report(using=DefaultReporter())
|
|
217
|
-
.exit(using=typer.Exit)
|
|
218
|
-
)
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
@test_cli.command(
|
|
222
|
-
name="integration",
|
|
223
|
-
help="Run integration tests.",
|
|
224
|
-
)
|
|
225
|
-
def _(
|
|
226
|
-
ci: bool = typer.Option(
|
|
227
|
-
False,
|
|
228
|
-
"--ci",
|
|
229
|
-
help="Run in CI mode.",
|
|
230
|
-
),
|
|
231
|
-
) -> None:
|
|
232
|
-
(
|
|
233
|
-
Codex(target=Path("./tests/integration"))
|
|
234
|
-
.ci(on=ci)
|
|
235
|
-
.test()
|
|
236
|
-
.report(using=DefaultReporter())
|
|
237
|
-
.exit(using=typer.Exit)
|
|
238
|
-
)
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
@test_cli.command(
|
|
242
|
-
name="behaviour",
|
|
243
|
-
help="Run behaviour tests.",
|
|
244
|
-
)
|
|
245
|
-
def _() -> None:
|
|
246
|
-
(
|
|
247
|
-
Codex(target=Path("."))
|
|
248
|
-
.test_behaviour()
|
|
249
|
-
.report(using=DefaultReporter())
|
|
250
|
-
.exit(using=typer.Exit)
|
|
251
|
-
)
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
if __name__ == "__main__":
|
|
255
|
-
cli()
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
import typer
|
|
4
|
+
|
|
5
|
+
from codex.reporters import DefaultReporter
|
|
6
|
+
from codex.service import Codex, Git
|
|
7
|
+
|
|
8
|
+
cli = typer.Typer(no_args_is_help=True)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@cli.command(
|
|
12
|
+
name="sync",
|
|
13
|
+
help="Inject standards into pyproject TOML file.",
|
|
14
|
+
)
|
|
15
|
+
def _(
|
|
16
|
+
path: str = typer.Option(
|
|
17
|
+
".",
|
|
18
|
+
"--path",
|
|
19
|
+
"-p",
|
|
20
|
+
help="Target directory.",
|
|
21
|
+
),
|
|
22
|
+
dry_run: bool = typer.Option(
|
|
23
|
+
False,
|
|
24
|
+
"--dry-run",
|
|
25
|
+
help="Show changes without applying them.",
|
|
26
|
+
),
|
|
27
|
+
) -> None:
|
|
28
|
+
(
|
|
29
|
+
Codex(target=Path(path))
|
|
30
|
+
.sync(dry_run=dry_run)
|
|
31
|
+
.report(using=DefaultReporter())
|
|
32
|
+
.exit(using=typer.Exit)
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@cli.command(
|
|
37
|
+
name="install",
|
|
38
|
+
help="Install project tools and dependencies.",
|
|
39
|
+
)
|
|
40
|
+
def _(
|
|
41
|
+
path: str = typer.Option(
|
|
42
|
+
".",
|
|
43
|
+
"--path",
|
|
44
|
+
"-p",
|
|
45
|
+
help="Target directory.",
|
|
46
|
+
),
|
|
47
|
+
) -> None:
|
|
48
|
+
(
|
|
49
|
+
Codex(target=Path(path))
|
|
50
|
+
.install()
|
|
51
|
+
.report(using=DefaultReporter())
|
|
52
|
+
.exit(using=typer.Exit)
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@cli.command(
|
|
57
|
+
name="lock",
|
|
58
|
+
help="Lock project dependencies.",
|
|
59
|
+
)
|
|
60
|
+
def _(
|
|
61
|
+
path: str = typer.Option(
|
|
62
|
+
".",
|
|
63
|
+
"--path",
|
|
64
|
+
"-p",
|
|
65
|
+
help="Target directory.",
|
|
66
|
+
),
|
|
67
|
+
) -> None:
|
|
68
|
+
(
|
|
69
|
+
Codex(target=Path(path))
|
|
70
|
+
.lock()
|
|
71
|
+
.report(using=DefaultReporter())
|
|
72
|
+
.exit(using=typer.Exit)
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@cli.command(
|
|
77
|
+
name="update",
|
|
78
|
+
help="Update project dependencies.",
|
|
79
|
+
)
|
|
80
|
+
def _(
|
|
81
|
+
path: str = typer.Option(
|
|
82
|
+
".",
|
|
83
|
+
"--path",
|
|
84
|
+
"-p",
|
|
85
|
+
help="Target directory.",
|
|
86
|
+
),
|
|
87
|
+
) -> None:
|
|
88
|
+
(
|
|
89
|
+
Codex(target=Path(path))
|
|
90
|
+
.update()
|
|
91
|
+
.report(using=DefaultReporter())
|
|
92
|
+
.exit(using=typer.Exit)
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
@cli.command(
|
|
97
|
+
name="build",
|
|
98
|
+
help="Build a Docker image.",
|
|
99
|
+
)
|
|
100
|
+
def _(
|
|
101
|
+
tag: str = typer.Option(
|
|
102
|
+
...,
|
|
103
|
+
"--tag",
|
|
104
|
+
"-t",
|
|
105
|
+
help="Target tag, e.g. my-project:latest",
|
|
106
|
+
),
|
|
107
|
+
path: str = typer.Option(
|
|
108
|
+
".",
|
|
109
|
+
"--path",
|
|
110
|
+
"-p",
|
|
111
|
+
help="Target directory.",
|
|
112
|
+
),
|
|
113
|
+
) -> None:
|
|
114
|
+
(
|
|
115
|
+
Codex(target=Path(path))
|
|
116
|
+
.build(tag=tag)
|
|
117
|
+
.report(using=DefaultReporter())
|
|
118
|
+
.exit(using=typer.Exit)
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
@cli.command(
|
|
123
|
+
name="lint",
|
|
124
|
+
help="Run linting (Ruff) and type checking (MyPy).",
|
|
125
|
+
)
|
|
126
|
+
def _(
|
|
127
|
+
path: str = typer.Option(
|
|
128
|
+
".",
|
|
129
|
+
"--path",
|
|
130
|
+
"-p",
|
|
131
|
+
help="Target directory.",
|
|
132
|
+
),
|
|
133
|
+
ci: bool = typer.Option(
|
|
134
|
+
False,
|
|
135
|
+
"--ci",
|
|
136
|
+
help="Run in CI mode.",
|
|
137
|
+
),
|
|
138
|
+
silent: bool = typer.Option(
|
|
139
|
+
False,
|
|
140
|
+
"--silent",
|
|
141
|
+
"-s",
|
|
142
|
+
help="Suppress output.",
|
|
143
|
+
),
|
|
144
|
+
) -> None:
|
|
145
|
+
(
|
|
146
|
+
Codex(target=Path(path))
|
|
147
|
+
.ci(on=ci)
|
|
148
|
+
.lint()
|
|
149
|
+
.silenced(when=silent)
|
|
150
|
+
.report(using=DefaultReporter())
|
|
151
|
+
.exit(using=typer.Exit)
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
@cli.command(
|
|
156
|
+
name="fix",
|
|
157
|
+
help="Automatically fix Ruff linting errors.",
|
|
158
|
+
)
|
|
159
|
+
def _(
|
|
160
|
+
path: str = typer.Option(
|
|
161
|
+
".",
|
|
162
|
+
"--path",
|
|
163
|
+
"-p",
|
|
164
|
+
help="Target directory.",
|
|
165
|
+
),
|
|
166
|
+
silent: bool = typer.Option(
|
|
167
|
+
False,
|
|
168
|
+
"--silent",
|
|
169
|
+
"-s",
|
|
170
|
+
help="Suppress output.",
|
|
171
|
+
),
|
|
172
|
+
unsafe: bool = typer.Option(
|
|
173
|
+
False,
|
|
174
|
+
"--unsafe",
|
|
175
|
+
help="Run unsafe Ruff fixes.",
|
|
176
|
+
),
|
|
177
|
+
) -> None:
|
|
178
|
+
(
|
|
179
|
+
Codex(target=Path(path))
|
|
180
|
+
.fix(unsafe=unsafe)
|
|
181
|
+
.silenced(when=silent)
|
|
182
|
+
.report(using=DefaultReporter())
|
|
183
|
+
.exit(using=typer.Exit)
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
@cli.command(
|
|
188
|
+
name="amend",
|
|
189
|
+
help="Amend the last git commit without changing the message.",
|
|
190
|
+
)
|
|
191
|
+
def _() -> None:
|
|
192
|
+
Git().amend().report(using=DefaultReporter()).exit(using=typer.Exit)
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
import typer
|
|
4
|
+
|
|
5
|
+
from codex.reporters import DefaultReporter
|
|
6
|
+
from codex.service import Codex
|
|
7
|
+
|
|
8
|
+
cli = typer.Typer()
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@cli.command(
|
|
12
|
+
name="unit",
|
|
13
|
+
help="Run programmer tests.",
|
|
14
|
+
)
|
|
15
|
+
def run_unit_tests(
|
|
16
|
+
path: str = typer.Option(
|
|
17
|
+
".",
|
|
18
|
+
"--path",
|
|
19
|
+
"-p",
|
|
20
|
+
help="Target directory.",
|
|
21
|
+
),
|
|
22
|
+
ci: bool = typer.Option(
|
|
23
|
+
False,
|
|
24
|
+
"--ci",
|
|
25
|
+
help="Run in CI mode.",
|
|
26
|
+
),
|
|
27
|
+
) -> None:
|
|
28
|
+
(
|
|
29
|
+
Codex(target=Path(path))
|
|
30
|
+
.ci(on=ci)
|
|
31
|
+
.test()
|
|
32
|
+
.report(using=DefaultReporter())
|
|
33
|
+
.exit(using=typer.Exit)
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@cli.command(
|
|
38
|
+
name="integration",
|
|
39
|
+
help="Run integration tests.",
|
|
40
|
+
)
|
|
41
|
+
def _(
|
|
42
|
+
path: str = typer.Option(
|
|
43
|
+
".",
|
|
44
|
+
"--path",
|
|
45
|
+
"-p",
|
|
46
|
+
help="Target directory.",
|
|
47
|
+
),
|
|
48
|
+
ci: bool = typer.Option(
|
|
49
|
+
False,
|
|
50
|
+
"--ci",
|
|
51
|
+
help="Run in CI mode.",
|
|
52
|
+
),
|
|
53
|
+
) -> None:
|
|
54
|
+
(
|
|
55
|
+
Codex(target=Path(path))
|
|
56
|
+
.ci(on=ci)
|
|
57
|
+
.test_integration()
|
|
58
|
+
.report(using=DefaultReporter())
|
|
59
|
+
.exit(using=typer.Exit)
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@cli.command(
|
|
64
|
+
name="behaviour",
|
|
65
|
+
help="Run behaviour tests.",
|
|
66
|
+
)
|
|
67
|
+
def _(
|
|
68
|
+
path: str = typer.Option(
|
|
69
|
+
".",
|
|
70
|
+
"--path",
|
|
71
|
+
"-p",
|
|
72
|
+
help="Target directory.",
|
|
73
|
+
),
|
|
74
|
+
ci: bool = typer.Option(
|
|
75
|
+
False,
|
|
76
|
+
"--ci",
|
|
77
|
+
help="Run in CI mode.",
|
|
78
|
+
),
|
|
79
|
+
) -> None:
|
|
80
|
+
(
|
|
81
|
+
Codex(target=Path(path))
|
|
82
|
+
.ci(on=ci)
|
|
83
|
+
.test_behaviour()
|
|
84
|
+
.report(using=DefaultReporter())
|
|
85
|
+
.exit(using=typer.Exit)
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@cli.callback(invoke_without_command=True)
|
|
90
|
+
def _(ctx: typer.Context) -> None:
|
|
91
|
+
if ctx.invoked_subcommand is not None:
|
|
92
|
+
return
|
|
93
|
+
|
|
94
|
+
run_unit_tests(path=".", ci=False)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "apexcodexpy"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.3"
|
|
4
4
|
description = "The Non-Destructive Configuration Steward for Python Projects."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [
|
|
@@ -10,7 +10,7 @@ dynamic = ["dependencies"]
|
|
|
10
10
|
requires-python = ">=3.11"
|
|
11
11
|
|
|
12
12
|
[project.scripts]
|
|
13
|
-
codex = "codex.
|
|
13
|
+
codex = "codex.runner:cli"
|
|
14
14
|
|
|
15
15
|
[tool.poetry]
|
|
16
16
|
packages = [
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|