lange-python 0.3.19__tar.gz → 0.3.22__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 (31) hide show
  1. {lange_python-0.3.19 → lange_python-0.3.22}/PKG-INFO +2 -2
  2. {lange_python-0.3.19 → lange_python-0.3.22}/README.md +1 -1
  3. {lange_python-0.3.19 → lange_python-0.3.22}/lange/cli/build/_command.py +29 -9
  4. {lange_python-0.3.19 → lange_python-0.3.22}/lange/cli/build/_discovery.py +3 -2
  5. {lange_python-0.3.19 → lange_python-0.3.22}/lange/cli/build/_docker.py +28 -3
  6. {lange_python-0.3.19 → lange_python-0.3.22}/lange/tunnel/_client.py +1 -1
  7. {lange_python-0.3.19 → lange_python-0.3.22}/pyproject.toml +1 -1
  8. {lange_python-0.3.19 → lange_python-0.3.22}/lange/__init__.py +0 -0
  9. {lange_python-0.3.19 → lange_python-0.3.22}/lange/__main__.py +0 -0
  10. {lange_python-0.3.19 → lange_python-0.3.22}/lange/_util/__init__.py +0 -0
  11. {lange_python-0.3.19 → lange_python-0.3.22}/lange/_util/_base_client.py +0 -0
  12. {lange_python-0.3.19 → lange_python-0.3.22}/lange/_util/_key_handling.py +0 -0
  13. {lange_python-0.3.19 → lange_python-0.3.22}/lange/cli/__init__.py +0 -0
  14. {lange_python-0.3.19 → lange_python-0.3.22}/lange/cli/build/__init__.py +0 -0
  15. {lange_python-0.3.19 → lange_python-0.3.22}/lange/cli/build/_poetry.py +0 -0
  16. {lange_python-0.3.19 → lange_python-0.3.22}/lange/cli/build/_types.py +0 -0
  17. {lange_python-0.3.19 → lange_python-0.3.22}/lange/cli/code/__init__.py +0 -0
  18. {lange_python-0.3.19 → lange_python-0.3.22}/lange/cli/code/_stats.py +0 -0
  19. {lange_python-0.3.19 → lange_python-0.3.22}/lange/cli/code/audit/__init__.py +0 -0
  20. {lange_python-0.3.19 → lange_python-0.3.22}/lange/cli/code/audit/_command.py +0 -0
  21. {lange_python-0.3.19 → lange_python-0.3.22}/lange/cli/code/audit/_discovery.py +0 -0
  22. {lange_python-0.3.19 → lange_python-0.3.22}/lange/cli/code/audit/_runner.py +0 -0
  23. {lange_python-0.3.19 → lange_python-0.3.22}/lange/cli/code/audit/_types.py +0 -0
  24. {lange_python-0.3.19 → lange_python-0.3.22}/lange/cli/distribution/__init__.py +0 -0
  25. {lange_python-0.3.19 → lange_python-0.3.22}/lange/cli/distribution/_command.py +0 -0
  26. {lange_python-0.3.19 → lange_python-0.3.22}/lange/distribution/__init__.py +0 -0
  27. {lange_python-0.3.19 → lange_python-0.3.22}/lange/distribution/_client.py +0 -0
  28. {lange_python-0.3.19 → lange_python-0.3.22}/lange/distribution/_update_macos.py +0 -0
  29. {lange_python-0.3.19 → lange_python-0.3.22}/lange/distribution/_util.py +0 -0
  30. {lange_python-0.3.19 → lange_python-0.3.22}/lange/tunnel/__init__.py +0 -0
  31. {lange_python-0.3.19 → lange_python-0.3.22}/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.19
3
+ Version: 0.3.22
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.10
@@ -74,7 +74,7 @@ client.reload(api_key=None) # clears authentication and marks the client unauth
74
74
  from lange.tunnel import Tunnel
75
75
 
76
76
  tunnel = Tunnel(
77
- host="wss://tunnel.lange-labs.com",
77
+ host="wss://api.lange-labs.com",
78
78
  api_key="your-bearer-token",
79
79
  target="http://localhost:3000",
80
80
  )
@@ -56,7 +56,7 @@ client.reload(api_key=None) # clears authentication and marks the client unauth
56
56
  from lange.tunnel import Tunnel
57
57
 
58
58
  tunnel = Tunnel(
59
- host="wss://tunnel.lange-labs.com",
59
+ host="wss://api.lange-labs.com",
60
60
  api_key="your-bearer-token",
61
61
  target="http://localhost:3000",
62
62
  )
@@ -13,7 +13,12 @@ from ._discovery import (
13
13
  prompt_for_build_system_selection,
14
14
  resolve_build_folder,
15
15
  )
16
- from ._docker import ensure_docker_is_available, parse_image_reference, run_docker_build
16
+ from ._docker import (
17
+ discover_dockerfiles,
18
+ ensure_docker_is_available,
19
+ parse_image_reference,
20
+ run_docker_build,
21
+ )
17
22
  from ._poetry import run_poetry_build, run_poetry_publish, run_poetry_version_patch
18
23
  from ._types import DOCKER_BUILD_SYSTEM, POETRY_BUILD_SYSTEM, BuildSystem
19
24
 
@@ -130,10 +135,9 @@ def resolve_build_system(
130
135
  :returns: Resolved build system value.
131
136
  """
132
137
  if force_docker:
133
- dockerfile = folder / "Dockerfile"
134
- if not dockerfile.is_file():
138
+ if not discover_dockerfiles(folder):
135
139
  raise click.ClickException(
136
- f"Dockerfile was not found at '{dockerfile}'."
140
+ f"Dockerfile was not found at '{folder / 'Dockerfile'}'."
137
141
  )
138
142
  return DOCKER_BUILD_SYSTEM
139
143
 
@@ -166,14 +170,30 @@ def _run_docker_flow(folder: Path, publish: bool) -> None:
166
170
  :param publish: Whether publish was requested via flag.
167
171
  :returns: ``None``.
168
172
  """
169
- dockerfile = folder / "Dockerfile"
170
- image_reference = parse_image_reference(dockerfile)
173
+ dockerfiles = discover_dockerfiles(folder)
174
+ if not dockerfiles:
175
+ raise click.ClickException(
176
+ f"Dockerfile was not found at '{folder / 'Dockerfile'}'."
177
+ )
178
+
171
179
  ensure_docker_is_available()
172
180
 
173
181
  try:
174
- run_docker_build(folder=folder, image_reference=image_reference, publish=publish)
175
- if not publish and _confirm_publish():
176
- run_docker_build(folder=folder, image_reference=image_reference, publish=True)
182
+ for dockerfile in dockerfiles:
183
+ image_reference = parse_image_reference(dockerfile)
184
+ run_docker_build(
185
+ folder=folder,
186
+ dockerfile=dockerfile,
187
+ image_reference=image_reference,
188
+ publish=publish,
189
+ )
190
+ if not publish and _confirm_publish():
191
+ run_docker_build(
192
+ folder=folder,
193
+ dockerfile=dockerfile,
194
+ image_reference=image_reference,
195
+ publish=True,
196
+ )
177
197
  except subprocess.CalledProcessError as error:
178
198
  raise click.ClickException(
179
199
  f"Docker command failed with exit code {error.returncode}."
@@ -6,6 +6,7 @@ from pathlib import Path
6
6
 
7
7
  import click
8
8
 
9
+ from ._docker import discover_dockerfiles
9
10
  from ._types import DOCKER_BUILD_SYSTEM, POETRY_BUILD_SYSTEM, BuildSystem
10
11
 
11
12
 
@@ -82,7 +83,7 @@ def list_buildable_folders(
82
83
  """
83
84
  candidates = list_candidate_folders(root)
84
85
  if force_docker:
85
- return [folder for folder in candidates if (folder / "Dockerfile").is_file()]
86
+ return [folder for folder in candidates if discover_dockerfiles(folder)]
86
87
  if force_poetry:
87
88
  return [folder for folder in candidates if (folder / "pyproject.toml").is_file()]
88
89
  return [
@@ -98,7 +99,7 @@ def detect_available_build_systems(folder: Path) -> list[BuildSystem]:
98
99
  :returns: Ordered list of detected build systems.
99
100
  """
100
101
  available: list[BuildSystem] = []
101
- if (folder / "Dockerfile").is_file():
102
+ if discover_dockerfiles(folder):
102
103
  available.append(DOCKER_BUILD_SYSTEM)
103
104
  if (folder / "pyproject.toml").is_file():
104
105
  available.append(POETRY_BUILD_SYSTEM)
@@ -14,6 +14,25 @@ PLATFORMS = "linux/amd64,linux/arm64"
14
14
  IMAGE_LINE_PATTERN = re.compile(r"^#\s*image:\s*(?P<image>\S+)\s*$", re.IGNORECASE)
15
15
 
16
16
 
17
+ def discover_dockerfiles(folder: Path) -> list[Path]:
18
+ """
19
+ Discover Dockerfiles that should be built for a folder.
20
+
21
+ :param folder: Folder that should be inspected.
22
+ :returns: Default Dockerfile when present, otherwise sorted named Dockerfiles.
23
+ """
24
+ default_dockerfile = folder / "Dockerfile"
25
+ if default_dockerfile.is_file():
26
+ return [default_dockerfile]
27
+
28
+ named_dockerfiles = [
29
+ path
30
+ for path in folder.glob("*.Dockerfile")
31
+ if path.is_file()
32
+ ]
33
+ return sorted(named_dockerfiles, key=lambda item: item.name.lower())
34
+
35
+
17
36
  def ensure_docker_is_available() -> None:
18
37
  """
19
38
  Validate that docker is installed and available in ``PATH``.
@@ -98,16 +117,22 @@ def ensure_buildx_builder() -> None:
98
117
  )
99
118
 
100
119
 
101
- def run_docker_build(folder: Path, image_reference: str, publish: bool) -> None:
120
+ def run_docker_build(
121
+ folder: Path,
122
+ dockerfile: Path,
123
+ image_reference: str,
124
+ publish: bool,
125
+ ) -> None:
102
126
  """
103
127
  Execute docker buildx build for the given folder.
104
128
 
105
129
  :param folder: Build context folder.
130
+ :param dockerfile: Dockerfile to build.
106
131
  :param image_reference: Docker image name including tag.
107
132
  :param publish: Whether ``--push`` should be included.
108
133
  :returns: ``None``.
109
134
  """
110
- dockerfile = (folder / "Dockerfile").resolve()
135
+ resolved_dockerfile = dockerfile.resolve()
111
136
  ensure_buildx_builder()
112
137
 
113
138
  command: list[str] = [
@@ -117,7 +142,7 @@ def run_docker_build(folder: Path, image_reference: str, publish: bool) -> None:
117
142
  "--platform",
118
143
  PLATFORMS,
119
144
  "--file",
120
- str(dockerfile),
145
+ str(resolved_dockerfile),
121
146
  "--tag",
122
147
  image_reference,
123
148
  ]
@@ -26,7 +26,7 @@ class Tunnel(BaseLangeLabsClient):
26
26
 
27
27
  def __init__(
28
28
  self,
29
- host: str = "wss://tunnel.lange-labs.com",
29
+ host: str = "wss://api.lange-labs.com",
30
30
  api_key: str | None = None,
31
31
  target: str = "http://localhost:80",
32
32
  verify_ssl: bool = True,
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "lange-python"
3
- version = "0.3.19"
3
+ version = "0.3.22"
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"}