apexcodexpy 0.4.4__tar.gz → 0.5.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apexcodexpy
3
- Version: 0.4.4
3
+ Version: 0.5.3
4
4
  Summary: The Non-Destructive Configuration Steward for Python Projects.
5
5
  License-File: LICENSE
6
6
  Author: Apex Dev
@@ -68,6 +68,22 @@ class Codex:
68
68
  def build(self, tag: str) -> TaskResult:
69
69
  return self.tools.build(tag).execute()
70
70
 
71
+ def push(
72
+ self,
73
+ tag: str,
74
+ registry: str,
75
+ organization: str,
76
+ token: str,
77
+ actor: str,
78
+ ) -> TaskResult:
79
+ return self.tools.push(
80
+ tag=tag,
81
+ registry=registry,
82
+ organization=organization,
83
+ token=token,
84
+ actor=actor,
85
+ ).execute()
86
+
71
87
 
72
88
  @dataclass(frozen=True)
73
89
  class CiCodex:
@@ -248,7 +264,7 @@ class CodexTools:
248
264
  command=(
249
265
  Command("docker build")
250
266
  .flag(tag=True)
251
- .append(tag)
267
+ .append(tag.lower())
252
268
  .flag(build_arg=True)
253
269
  .with_a(RELEASE=Git().revision() or str(int(time())))
254
270
  .append(self.target)
@@ -257,6 +273,46 @@ class CodexTools:
257
273
  )
258
274
  )
259
275
 
276
+ def push(
277
+ self,
278
+ tag: str,
279
+ registry: str,
280
+ organization: str,
281
+ token: str,
282
+ actor: str,
283
+ ) -> Executable:
284
+ local_tag = tag.lower()
285
+ remote_tag = f"{registry}/{organization.lower()}/{local_tag}"
286
+
287
+ return (
288
+ MultiProgram()
289
+ .attach(
290
+ Program(
291
+ name="tag",
292
+ command=Command("docker tag").append(local_tag).append(remote_tag),
293
+ )
294
+ )
295
+ .attach(
296
+ Program(
297
+ name="login",
298
+ command=(
299
+ Command("docker login")
300
+ .append(registry)
301
+ .flag(username=True)
302
+ .append(actor)
303
+ .flag(password=True)
304
+ .append(token)
305
+ ),
306
+ )
307
+ )
308
+ .attach(
309
+ Program(
310
+ name="push",
311
+ command=Command("docker push").append(remote_tag),
312
+ )
313
+ )
314
+ )
315
+
260
316
 
261
317
  @dataclass(frozen=True)
262
318
  class Git:
@@ -104,7 +104,7 @@ class Deptry:
104
104
  on: Path
105
105
 
106
106
  def lint(self) -> Command:
107
- return Command("deptry").append(self.on).append("||").append("True")
107
+ return Command("deptry").append(self.on)
108
108
 
109
109
 
110
110
  @dataclass(frozen=True, kw_only=True)
@@ -122,6 +122,59 @@ def _(
122
122
  )
123
123
 
124
124
 
125
+ @cli.command(
126
+ name="push",
127
+ help="Tag and push a Docker image to GitHub Container Registry.",
128
+ )
129
+ def _(
130
+ tag: str = typer.Option(
131
+ ...,
132
+ "--tag",
133
+ "-t",
134
+ help="Image tag, e.g. latest.",
135
+ ),
136
+ registry: str = typer.Option(
137
+ "ghcr.io",
138
+ "--registry",
139
+ help="Container registry host.",
140
+ ),
141
+ organization: str = typer.Option(
142
+ ...,
143
+ "--organization",
144
+ "-o",
145
+ help="GHCR organization or namespace.",
146
+ ),
147
+ token: str = typer.Option(
148
+ ...,
149
+ "--token",
150
+ help="GitHub token for registry login.",
151
+ ),
152
+ actor: str = typer.Option(
153
+ ...,
154
+ "--actor",
155
+ help="GitHub username for registry login.",
156
+ ),
157
+ path: str = typer.Option(
158
+ ".",
159
+ "--path",
160
+ "-p",
161
+ help="Target directory.",
162
+ ),
163
+ ) -> None:
164
+ (
165
+ Codex.target(Path(path))
166
+ .push(
167
+ tag=tag,
168
+ registry=registry,
169
+ organization=organization,
170
+ token=token,
171
+ actor=actor,
172
+ )
173
+ .report(using=DefaultReporter())
174
+ .exit(using=typer.Exit)
175
+ )
176
+
177
+
125
178
  @cli.command(
126
179
  name="lint",
127
180
  help="Run linting (Ruff) and type checking (MyPy).",
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "apexcodexpy"
3
- version = "0.4.4"
3
+ version = "0.5.3"
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