apexcodexpy 0.6.6__tar.gz → 0.7.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.
Files changed (25) hide show
  1. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/PKG-INFO +2 -1
  2. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/codex/infra/program.py +7 -4
  3. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/codex/infra/service.py +6 -0
  4. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/codex/infra/typer/root.py +15 -0
  5. apexcodexpy-0.7.2/codex/infra/workflows/lock.py +33 -0
  6. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/codex/infra/yamler.py +3 -2
  7. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/pyproject.toml +1 -1
  8. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/LICENSE +0 -0
  9. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/README.md +0 -0
  10. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/codex/__init__.py +0 -0
  11. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/codex/infra/__init__.py +0 -0
  12. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/codex/infra/pyproject.py +0 -0
  13. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/codex/infra/reporters.py +0 -0
  14. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/codex/infra/result.py +0 -0
  15. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/codex/infra/tools.py +0 -0
  16. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/codex/infra/typer/__init__.py +0 -0
  17. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/codex/infra/typer/device.py +0 -0
  18. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/codex/infra/typer/testing.py +0 -0
  19. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/codex/infra/workflows/__init__.py +0 -0
  20. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/codex/infra/workflows/base.py +0 -0
  21. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/codex/infra/workflows/build.py +0 -0
  22. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/codex/infra/workflows/ci.py +0 -0
  23. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/codex/infra/workflows/dependabot.py +0 -0
  24. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/codex/infra/workflows/validate.py +0 -0
  25. {apexcodexpy-0.6.6 → apexcodexpy-0.7.2}/codex/runner.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apexcodexpy
3
- Version: 0.6.6
3
+ Version: 0.7.2
4
4
  Summary: The Non-Destructive Configuration Steward for Python Projects.
5
5
  License-File: LICENSE
6
6
  Author: Apex Dev
@@ -11,6 +11,7 @@ Classifier: Programming Language :: Python :: 3.11
11
11
  Classifier: Programming Language :: Python :: 3.12
12
12
  Classifier: Programming Language :: Python :: 3.13
13
13
  Classifier: Programming Language :: Python :: 3.14
14
+ Classifier: Programming Language :: Python :: 3.15
14
15
  Requires-Dist: deptry
15
16
  Requires-Dist: mypy
16
17
  Requires-Dist: ruamel-yaml
@@ -33,15 +33,18 @@ class Command:
33
33
 
34
34
  _arguments: list[str] = field(init=False, default_factory=list)
35
35
 
36
- def with_a(self, **kwargs: Any) -> Command:
37
- return self.and_a(**kwargs)
36
+ def with_a(self, when: bool = True, **kwargs: Any) -> Command:
37
+ return self.and_a(**kwargs, when=when)
38
+
39
+ def and_a(self, when: bool = True, **kwargs: Any) -> Command:
40
+ if not when:
41
+ return self
38
42
 
39
- def and_a(self, **kwargs: Any) -> Command:
40
43
  assert len(kwargs) == 1, "with_a/and_a supports one argument at a time."
41
44
 
42
45
  name, value = kwargs.popitem()
43
46
 
44
- return self.append(f"--{name}={value}")
47
+ return self.append(f"--{self.dashify(name)}={value}")
45
48
 
46
49
  def flag(self, **kwargs: bool | None) -> Command:
47
50
  for name, value in kwargs.items():
@@ -22,6 +22,7 @@ from codex.infra.workflows import (
22
22
  CheckCodeWorkflow,
23
23
  DependabotWorkflow,
24
24
  )
25
+ from codex.infra.workflows.lock import CodexLockWorkflow
25
26
 
26
27
 
27
28
  @dataclass(frozen=True)
@@ -140,6 +141,7 @@ class CodexTools:
140
141
  BuildCodeWorkflow(disclaimer=False).sync(self.target, force=force),
141
142
  when=self.target.joinpath("Dockerfile").exists(),
142
143
  )
144
+ .attach(CodexLockWorkflow().sync(self.target, force=force))
143
145
  )
144
146
 
145
147
  def lock(self) -> Executable:
@@ -231,6 +233,10 @@ class CodexTools:
231
233
  .run()
232
234
  .flag(cov=not in_ci or None)
233
235
  .flag(last_failed=not in_ci or None)
236
+ .with_a(
237
+ hypothesis_profile="ci" if in_ci else "dev",
238
+ when=Version().is_installed("hypothesis"),
239
+ )
234
240
  ),
235
241
  )
236
242
  )
@@ -4,10 +4,25 @@ import typer
4
4
 
5
5
  from codex.infra.reporters import DefaultReporter, SimpleReporter
6
6
  from codex.infra.service import Codex, Git
7
+ from codex.infra.workflows.lock import CodexLockWorkflow
7
8
 
8
9
  cli = typer.Typer(no_args_is_help=True)
9
10
 
10
11
 
12
+ @cli.callback()
13
+ def verify_codex_lock(ctx: typer.Context) -> None:
14
+ if ctx.invoked_subcommand == "sync":
15
+ return
16
+
17
+ if CodexLockWorkflow().verify():
18
+ return
19
+
20
+ typer.echo("Codex is out of sync!")
21
+ typer.echo("Run `codex sync` to bring configuration up to date")
22
+
23
+ raise typer.Exit(1)
24
+
25
+
11
26
  @cli.command(
12
27
  name="version",
13
28
  help="Show the codex version and exit.",
@@ -0,0 +1,33 @@
1
+ from __future__ import annotations
2
+
3
+ import hashlib
4
+ from dataclasses import dataclass
5
+ from pathlib import Path
6
+
7
+ from codex.infra.yamler import Yamler
8
+
9
+ from .base import YamlWorkflow
10
+
11
+
12
+ def hash_of(path: Path) -> str:
13
+ with path.open("rb") as f:
14
+ return hashlib.file_digest(f, hashlib.sha256).hexdigest()
15
+
16
+
17
+ @dataclass(frozen=True, kw_only=True)
18
+ class CodexLockWorkflow(YamlWorkflow):
19
+ name: str = "CodexLock"
20
+ path: Path = Path("codex.lock")
21
+
22
+ @property
23
+ def standards(self) -> Yamler:
24
+ return Yamler.parse(
25
+ {
26
+ "hashes": {
27
+ "pyproject": hash_of(Path("pyproject.toml")),
28
+ },
29
+ }
30
+ )
31
+
32
+ def verify(self) -> bool:
33
+ return self.path.exists() and self.standards == Yamler.read(self.path)
@@ -36,8 +36,9 @@ class Yamler:
36
36
  folding_positions.append(accumulator + i)
37
37
 
38
38
  scalar = FoldedScalarString(" ".join(clean_lines))
39
- scalar.fold_pos = folding_positions # type: ignore
40
- return scalar
39
+ scalar.fold_pos = folding_positions
40
+
41
+ return scalar # type: ignore
41
42
 
42
43
  def anchor(self, name: str) -> Yamler:
43
44
  self.value.yaml_set_anchor(name, always_dump=True)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "apexcodexpy"
3
- version = "0.6.6"
3
+ version = "0.7.2"
4
4
  description = "The Non-Destructive Configuration Steward for Python Projects."
5
5
  readme = "README.md"
6
6
  authors = [
File without changes
File without changes
File without changes