lange-python 0.3.1__tar.gz → 0.3.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. {lange_python-0.3.1 → lange_python-0.3.2}/PKG-INFO +14 -1
  2. {lange_python-0.3.1 → lange_python-0.3.2}/README.md +13 -0
  3. {lange_python-0.3.1 → lange_python-0.3.2}/lange/cli/__init__.py +5 -2
  4. {lange_python-0.3.1 → lange_python-0.3.2}/lange/cli/build/_command.py +3 -1
  5. {lange_python-0.3.1 → lange_python-0.3.2}/lange/cli/build/_poetry.py +10 -0
  6. lange_python-0.3.2/lange/cli/distribution/__init__.py +5 -0
  7. lange_python-0.3.2/lange/cli/distribution/_command.py +55 -0
  8. {lange_python-0.3.1 → lange_python-0.3.2}/lange/distribution/_client.py +0 -1
  9. {lange_python-0.3.1 → lange_python-0.3.2}/pyproject.toml +1 -1
  10. {lange_python-0.3.1 → lange_python-0.3.2}/lange/__init__.py +0 -0
  11. {lange_python-0.3.1 → lange_python-0.3.2}/lange/__main__.py +0 -0
  12. {lange_python-0.3.1 → lange_python-0.3.2}/lange/_util/__init__.py +0 -0
  13. {lange_python-0.3.1 → lange_python-0.3.2}/lange/_util/_base_client.py +0 -0
  14. {lange_python-0.3.1 → lange_python-0.3.2}/lange/_util/_key_handling.py +0 -0
  15. {lange_python-0.3.1 → lange_python-0.3.2}/lange/cli/build/__init__.py +0 -0
  16. {lange_python-0.3.1 → lange_python-0.3.2}/lange/cli/build/_discovery.py +0 -0
  17. {lange_python-0.3.1 → lange_python-0.3.2}/lange/cli/build/_docker.py +0 -0
  18. {lange_python-0.3.1 → lange_python-0.3.2}/lange/cli/build/_types.py +0 -0
  19. {lange_python-0.3.1 → lange_python-0.3.2}/lange/cli/code/__init__.py +0 -0
  20. {lange_python-0.3.1 → lange_python-0.3.2}/lange/cli/code/_stats.py +0 -0
  21. {lange_python-0.3.1 → lange_python-0.3.2}/lange/distribution/__init__.py +0 -0
  22. {lange_python-0.3.1 → lange_python-0.3.2}/lange/distribution/_util.py +0 -0
  23. {lange_python-0.3.1 → lange_python-0.3.2}/lange/tunnel/__init__.py +0 -0
  24. {lange_python-0.3.1 → lange_python-0.3.2}/lange/tunnel/_client.py +0 -0
  25. {lange_python-0.3.1 → lange_python-0.3.2}/lange/tunnel/_util.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lange-python
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: A bundeld set of tools, clients for the lange-suite of tools and more.
5
5
  Author: contact@robertlange.me
6
6
  Requires-Python: >=3.13
@@ -17,6 +17,19 @@ Description-Content-Type: text/markdown
17
17
 
18
18
  Python helpers and clients for Lange services.
19
19
 
20
+ ## Distribution CLI
21
+
22
+ Publish a distribution artifact to the app services distribution system:
23
+
24
+ ```bash
25
+ export LANGE_LABS_API_KEY="your-api-key"
26
+ lange distribution publish \
27
+ --path ./dist/app.dmg \
28
+ --version 1.2.3 \
29
+ --distribution-name desktop-app \
30
+ --os macos
31
+ ```
32
+
20
33
  ## Tunnel worker
21
34
 
22
35
  ```python
@@ -2,6 +2,19 @@
2
2
 
3
3
  Python helpers and clients for Lange services.
4
4
 
5
+ ## Distribution CLI
6
+
7
+ Publish a distribution artifact to the app services distribution system:
8
+
9
+ ```bash
10
+ export LANGE_LABS_API_KEY="your-api-key"
11
+ lange distribution publish \
12
+ --path ./dist/app.dmg \
13
+ --version 1.2.3 \
14
+ --distribution-name desktop-app \
15
+ --os macos
16
+ ```
17
+
5
18
  ## Tunnel worker
6
19
 
7
20
  ```python
@@ -1,11 +1,13 @@
1
1
  """CLI commands for the ``lange`` Python package."""
2
2
 
3
3
  from __future__ import annotations
4
- from .code import code_group
5
- from .build import build_command
6
4
 
7
5
  import click
8
6
 
7
+ from .build import build_command
8
+ from .code import code_group
9
+ from .distribution import distribution_group
10
+
9
11
 
10
12
 
11
13
  @click.group()
@@ -19,3 +21,4 @@ def cli() -> None:
19
21
 
20
22
  cli.add_command(code_group, "code")
21
23
  cli.add_command(build_command, "build")
24
+ cli.add_command(distribution_group, "distribution")
@@ -14,7 +14,7 @@ from ._discovery import (
14
14
  resolve_build_folder,
15
15
  )
16
16
  from ._docker import ensure_docker_is_available, parse_image_reference, run_docker_build
17
- from ._poetry import run_poetry_build, run_poetry_publish
17
+ from ._poetry import run_poetry_build, run_poetry_publish, run_poetry_version_patch
18
18
  from ._types import DOCKER_BUILD_SYSTEM, POETRY_BUILD_SYSTEM, BuildSystem
19
19
 
20
20
 
@@ -191,6 +191,8 @@ def _run_poetry_flow(folder: Path, publish: bool) -> None:
191
191
  :returns: ``None``.
192
192
  """
193
193
  try:
194
+ if publish:
195
+ run_poetry_version_patch(folder=folder)
194
196
  run_poetry_build(folder=folder)
195
197
  if publish or _confirm_publish():
196
198
  run_poetry_publish(folder=folder)
@@ -16,6 +16,16 @@ def run_poetry_build(folder: Path) -> None:
16
16
  subprocess.run(["poetry", "build"], check=True, cwd=folder)
17
17
 
18
18
 
19
+ def run_poetry_version_patch(folder: Path) -> None:
20
+ """
21
+ Run ``poetry version patch`` in the target folder.
22
+
23
+ :param folder: Target folder containing ``pyproject.toml``.
24
+ :returns: ``None``.
25
+ """
26
+ subprocess.run(["poetry", "version", "patch"], check=True, cwd=folder)
27
+
28
+
19
29
  def run_poetry_publish(folder: Path) -> None:
20
30
  """
21
31
  Run ``poetry publish`` in the target folder.
@@ -0,0 +1,5 @@
1
+ """Distribution-related CLI commands for the ``lange`` package."""
2
+
3
+ from ._command import distribution_group
4
+
5
+ __all__ = ["distribution_group"]
@@ -0,0 +1,55 @@
1
+ """CLI commands for publishing distribution artifacts."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+
7
+ import click
8
+ import httpx
9
+
10
+ from ...distribution import DistributionClient
11
+
12
+
13
+ @click.group("distribution")
14
+ def distribution_group() -> None:
15
+ """
16
+ Group distribution-related CLI commands.
17
+
18
+ :returns: ``None``.
19
+ """
20
+
21
+
22
+ @distribution_group.command("publish")
23
+ @click.option("--path", "artifact_path", required=True, type=click.Path(path_type=Path), help="Artifact file to upload.")
24
+ @click.option("--version", "version_name", required=True, type=str, help="Distribution version to publish.")
25
+ @click.option(
26
+ "--distribution-name",
27
+ required=True,
28
+ type=str,
29
+ help="Distribution name in the app services distribution system.",
30
+ )
31
+ @click.option("--os", "os_name", required=True, type=str, help="Artifact operating system: windows, macos, or linux.")
32
+ def publish_distribution_command(
33
+ artifact_path: Path,
34
+ version_name: str,
35
+ distribution_name: str,
36
+ os_name: str,
37
+ ) -> None:
38
+ """
39
+ Publish one distribution artifact to the app services distribution system.
40
+
41
+ :param artifact_path: Artifact file path to upload.
42
+ :param version_name: Version string associated with the artifact.
43
+ :param distribution_name: Distribution name in the app service.
44
+ :param os_name: Operating-system label for the uploaded artifact.
45
+ :returns: ``None``.
46
+ """
47
+ try:
48
+ client = DistributionClient(distribution_name=distribution_name)
49
+ client.upload(path=artifact_path, version_name=version_name, os_name=os_name)
50
+ except (ValueError, httpx.HTTPError) as error:
51
+ raise click.ClickException(str(error)) from error
52
+
53
+ click.echo(
54
+ f"Published distribution '{distribution_name}' version '{version_name}' for '{os_name}'."
55
+ )
@@ -234,7 +234,6 @@ class DistributionClient(BaseLangeLabsClient):
234
234
  """
235
235
  Fetch the public distribution metadata payload from the app service.
236
236
 
237
- :param distribution_name: Distribution name to fetch.
238
237
  :returns: Decoded JSON payload.
239
238
  :raises httpx.HTTPError: If the request fails or returns invalid JSON.
240
239
  """
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "lange-python"
3
- version = "0.3.1"
3
+ version = "0.3.2"
4
4
  description = "A bundeld set of tools, clients for the lange-suite of tools and more."
5
5
  authors = [
6
6
  {name = "contact@robertlange.me"}