apexcodexpy 0.4.3__tar.gz → 0.4.4__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.4.3 → apexcodexpy-0.4.4}/PKG-INFO +1 -1
- {apexcodexpy-0.4.3 → apexcodexpy-0.4.4}/codex/infra/reporters.py +17 -0
- {apexcodexpy-0.4.3 → apexcodexpy-0.4.4}/codex/infra/service.py +15 -2
- {apexcodexpy-0.4.3 → apexcodexpy-0.4.4}/codex/infra/tools.py +18 -1
- {apexcodexpy-0.4.3 → apexcodexpy-0.4.4}/codex/infra/typer/root.py +9 -1
- {apexcodexpy-0.4.3 → apexcodexpy-0.4.4}/codex/infra/workflows.py +13 -3
- {apexcodexpy-0.4.3 → apexcodexpy-0.4.4}/pyproject.toml +1 -1
- {apexcodexpy-0.4.3 → apexcodexpy-0.4.4}/LICENSE +0 -0
- {apexcodexpy-0.4.3 → apexcodexpy-0.4.4}/README.md +0 -0
- {apexcodexpy-0.4.3 → apexcodexpy-0.4.4}/codex/__init__.py +0 -0
- {apexcodexpy-0.4.3 → apexcodexpy-0.4.4}/codex/infra/__init__.py +0 -0
- {apexcodexpy-0.4.3 → apexcodexpy-0.4.4}/codex/infra/program.py +0 -0
- {apexcodexpy-0.4.3 → apexcodexpy-0.4.4}/codex/infra/pyproject.py +0 -0
- {apexcodexpy-0.4.3 → apexcodexpy-0.4.4}/codex/infra/result.py +0 -0
- {apexcodexpy-0.4.3 → apexcodexpy-0.4.4}/codex/infra/typer/__init__.py +0 -0
- {apexcodexpy-0.4.3 → apexcodexpy-0.4.4}/codex/infra/typer/device.py +0 -0
- {apexcodexpy-0.4.3 → apexcodexpy-0.4.4}/codex/infra/typer/testing.py +0 -0
- {apexcodexpy-0.4.3 → apexcodexpy-0.4.4}/codex/runner.py +0 -0
|
@@ -7,6 +7,23 @@ from codex.infra.result import Reporter
|
|
|
7
7
|
from codex.infra.typer.device import TyperDevice
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
@dataclass(frozen=True)
|
|
11
|
+
class SimpleReporter:
|
|
12
|
+
device: _Device = field(default_factory=TyperDevice)
|
|
13
|
+
|
|
14
|
+
def success_of(self, name: str) -> None:
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
def failure_of(self, name: str) -> None:
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
def out(self, message: str) -> None:
|
|
21
|
+
self.device.echo(message)
|
|
22
|
+
|
|
23
|
+
def error(self, message: str) -> None:
|
|
24
|
+
self.device.echo(message)
|
|
25
|
+
|
|
26
|
+
|
|
10
27
|
@dataclass(frozen=True)
|
|
11
28
|
class DefaultReporter:
|
|
12
29
|
device: _Device = field(default_factory=TyperDevice)
|
|
@@ -6,8 +6,17 @@ from time import time
|
|
|
6
6
|
|
|
7
7
|
from codex.infra.program import Command, Executable, MultiProgram, Program
|
|
8
8
|
from codex.infra.pyproject import PyProjectToml
|
|
9
|
-
from codex.infra.result import TaskResult
|
|
10
|
-
from codex.infra.tools import
|
|
9
|
+
from codex.infra.result import ProgramResult, TaskResult
|
|
10
|
+
from codex.infra.tools import (
|
|
11
|
+
Deptry,
|
|
12
|
+
MyPy,
|
|
13
|
+
Pip,
|
|
14
|
+
Poetry,
|
|
15
|
+
PoetryRun,
|
|
16
|
+
Pytest,
|
|
17
|
+
Ruff,
|
|
18
|
+
Version,
|
|
19
|
+
)
|
|
11
20
|
from codex.infra.workflows import CheckCodeWorkflow, DependabotWorkflow
|
|
12
21
|
|
|
13
22
|
|
|
@@ -25,6 +34,10 @@ class Codex:
|
|
|
25
34
|
|
|
26
35
|
return self
|
|
27
36
|
|
|
37
|
+
@staticmethod
|
|
38
|
+
def version() -> TaskResult:
|
|
39
|
+
return ProgramResult(name="version").success(message=str(Version()))
|
|
40
|
+
|
|
28
41
|
def sync(self) -> TaskResult:
|
|
29
42
|
return self.tools.sync().execute()
|
|
30
43
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from dataclasses import dataclass, field
|
|
4
|
+
from importlib import metadata
|
|
4
5
|
from pathlib import Path
|
|
5
6
|
|
|
6
7
|
from codex.infra.program import (
|
|
@@ -103,7 +104,7 @@ class Deptry:
|
|
|
103
104
|
on: Path
|
|
104
105
|
|
|
105
106
|
def lint(self) -> Command:
|
|
106
|
-
return Command("deptry").append(self.on).append("||").append("
|
|
107
|
+
return Command("deptry").append(self.on).append("||").append("True")
|
|
107
108
|
|
|
108
109
|
|
|
109
110
|
@dataclass(frozen=True, kw_only=True)
|
|
@@ -124,3 +125,19 @@ class Pytest:
|
|
|
124
125
|
|
|
125
126
|
def run(self) -> Command:
|
|
126
127
|
return Command("pytest").append(self.target)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
@dataclass(frozen=True)
|
|
131
|
+
class Version:
|
|
132
|
+
@staticmethod
|
|
133
|
+
def of(package: str) -> str | None:
|
|
134
|
+
try:
|
|
135
|
+
return metadata.version(package)
|
|
136
|
+
except metadata.PackageNotFoundError:
|
|
137
|
+
return None
|
|
138
|
+
|
|
139
|
+
def is_installed(self, package: str) -> bool:
|
|
140
|
+
return self.of(package) is not None
|
|
141
|
+
|
|
142
|
+
def __str__(self) -> str:
|
|
143
|
+
return self.of("apexcodexpy") or "unknown"
|
|
@@ -2,12 +2,20 @@ from pathlib import Path
|
|
|
2
2
|
|
|
3
3
|
import typer
|
|
4
4
|
|
|
5
|
-
from codex.infra.reporters import DefaultReporter
|
|
5
|
+
from codex.infra.reporters import DefaultReporter, SimpleReporter
|
|
6
6
|
from codex.infra.service import Codex, Git
|
|
7
7
|
|
|
8
8
|
cli = typer.Typer(no_args_is_help=True)
|
|
9
9
|
|
|
10
10
|
|
|
11
|
+
@cli.command(
|
|
12
|
+
name="version",
|
|
13
|
+
help="Show the codex version and exit.",
|
|
14
|
+
)
|
|
15
|
+
def _() -> None:
|
|
16
|
+
Codex.version().report(using=SimpleReporter()).exit(using=typer.Exit)
|
|
17
|
+
|
|
18
|
+
|
|
11
19
|
@cli.command(
|
|
12
20
|
name="sync",
|
|
13
21
|
help="Inject standards into pyproject TOML file.",
|
|
@@ -13,6 +13,7 @@ from yaml import MappingNode
|
|
|
13
13
|
|
|
14
14
|
from codex.infra.program import Executable
|
|
15
15
|
from codex.infra.result import ProgramResult
|
|
16
|
+
from codex.infra.tools import Version
|
|
16
17
|
|
|
17
18
|
|
|
18
19
|
@dataclass(frozen=True, kw_only=True)
|
|
@@ -90,8 +91,16 @@ class CheckCodeWorkflow(YamlWorkflow):
|
|
|
90
91
|
"jobs": self._jobs(
|
|
91
92
|
lint="codex lint --ci",
|
|
92
93
|
test_unit="codex test unit --ci",
|
|
93
|
-
test_integration=
|
|
94
|
-
|
|
94
|
+
test_integration=(
|
|
95
|
+
"codex test integration --ci"
|
|
96
|
+
if Version().is_installed("pytest-docker")
|
|
97
|
+
else ""
|
|
98
|
+
),
|
|
99
|
+
test_behaviour=(
|
|
100
|
+
"codex test behaviour --ci"
|
|
101
|
+
if Version().is_installed("behave")
|
|
102
|
+
else ""
|
|
103
|
+
),
|
|
95
104
|
),
|
|
96
105
|
}
|
|
97
106
|
|
|
@@ -109,6 +118,7 @@ class CheckCodeWorkflow(YamlWorkflow):
|
|
|
109
118
|
],
|
|
110
119
|
}
|
|
111
120
|
for name, value in commands.items()
|
|
121
|
+
if value
|
|
112
122
|
}
|
|
113
123
|
|
|
114
124
|
@cached_property
|
|
@@ -122,7 +132,7 @@ class CheckCodeWorkflow(YamlWorkflow):
|
|
|
122
132
|
"uses": "actions/setup-python@v6",
|
|
123
133
|
"with": {
|
|
124
134
|
"python-version": self.python_version,
|
|
125
|
-
"pip-install": "apexcodexpy",
|
|
135
|
+
"pip-install": f"apexcodexpy=={Version()}",
|
|
126
136
|
},
|
|
127
137
|
}
|
|
128
138
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|