apexcodexpy 0.2.1__tar.gz → 0.2.2__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.2}/PKG-INFO +1 -1
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.2}/codex/cli.py +2 -2
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.2}/codex/service.py +72 -40
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.2}/codex/tasks/result.py +11 -2
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.2}/pyproject.toml +1 -1
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.2}/LICENSE +0 -0
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.2}/README.md +0 -0
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.2}/codex/__init__.py +0 -0
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.2}/codex/reporters.py +0 -0
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.2}/codex/tasks/__init__.py +0 -0
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.2}/codex/tasks/dependabot.py +0 -0
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.2}/codex/tasks/update.py +0 -0
- {apexcodexpy-0.2.1 → apexcodexpy-0.2.2}/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
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|