wexample-wex-addon-dev-python 7.3.1__py3-none-any.whl → 7.5.0__py3-none-any.whl

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 (23) hide show
  1. wexample_wex_addon_dev_python/services/__init__.py +0 -0
  2. wexample_wex_addon_dev_python/services/python/__init__.py +0 -0
  3. wexample_wex_addon_dev_python/services/python/app_service.py +85 -0
  4. wexample_wex_addon_dev_python/services/python/commands/__init__.py +0 -0
  5. wexample_wex_addon_dev_python/services/python/commands/service/__init__.py +0 -0
  6. wexample_wex_addon_dev_python/services/python/commands/service/install.py +42 -0
  7. wexample_wex_addon_dev_python/services/python/commands/service/setup.py +58 -0
  8. wexample_wex_addon_dev_python/services/python/docker/.wex.yml +2 -0
  9. wexample_wex_addon_dev_python/services/python/docker/docker-compose.yml +17 -0
  10. wexample_wex_addon_dev_python/services/python/samples/__init__.py +0 -0
  11. wexample_wex_addon_dev_python/services/python/samples/docker/__init__.py +0 -0
  12. wexample_wex_addon_dev_python/services/python/samples/docker/docker-compose.yml +5 -0
  13. wexample_wex_addon_dev_python/services/python/samples/docker/entrypoint.sh +4 -0
  14. wexample_wex_addon_dev_python/services/python/samples/docker/images/Dockerfile.base +16 -0
  15. wexample_wex_addon_dev_python/services/python/samples/docker/images/Dockerfile.develop +7 -0
  16. wexample_wex_addon_dev_python/services/python/samples/docker/images/__init__.py +0 -0
  17. wexample_wex_addon_dev_python/services/python/service.yml +8 -0
  18. wexample_wex_addon_dev_python/workdir/python_package_workdir.py +1 -1
  19. wexample_wex_addon_dev_python/workdir/python_workdir.py +3 -1
  20. {wexample_wex_addon_dev_python-7.3.1.dist-info → wexample_wex_addon_dev_python-7.5.0.dist-info}/METADATA +4 -4
  21. {wexample_wex_addon_dev_python-7.3.1.dist-info → wexample_wex_addon_dev_python-7.5.0.dist-info}/RECORD +23 -6
  22. {wexample_wex_addon_dev_python-7.3.1.dist-info → wexample_wex_addon_dev_python-7.5.0.dist-info}/WHEEL +0 -0
  23. {wexample_wex_addon_dev_python-7.3.1.dist-info → wexample_wex_addon_dev_python-7.5.0.dist-info}/entry_points.txt +0 -0
File without changes
@@ -0,0 +1,85 @@
1
+ from __future__ import annotations
2
+
3
+ from wexample_wex_addon_app.service.app_service import AppService as BaseAppService
4
+
5
+ PYPROJECT_TOML_CONTENT = """\
6
+ [build-system]
7
+ requires = ["pdm-backend"]
8
+ build-backend = "pdm.backend"
9
+
10
+ [project]
11
+ name = "app"
12
+ version = "0.0.1"
13
+ description = "Python app"
14
+ authors = [
15
+ { name = "weeger", email = "contact@wexample.com" },
16
+ ]
17
+ requires-python = ">=3.11,<3.14"
18
+ dependencies = [
19
+ ]
20
+
21
+ [tool.pdm]
22
+ distribution = true
23
+
24
+ [tool.pdm.build]
25
+ package-dir = "src"
26
+
27
+ [[tool.pdm.build.packages]]
28
+ include = "app"
29
+ from = "src"
30
+
31
+ [tool.pdm.dev-dependencies]
32
+ dev = [
33
+ "pytest>=8.0.0",
34
+ ]
35
+
36
+ [tool.pytest.ini_options]
37
+ testpaths = ["tests"]
38
+ pythonpath = ["src"]
39
+ """
40
+
41
+ MAIN_CONTENT = """\
42
+ if __name__ == "__main__":
43
+ print("OK")
44
+ """
45
+
46
+
47
+ class AppService(BaseAppService):
48
+ def get_workdir_contribution(self) -> dict:
49
+ from wexample_filestate.const.disk import DiskItemType
50
+
51
+ return {
52
+ "children": [
53
+ {
54
+ "name": "pyproject.toml",
55
+ "type": DiskItemType.FILE,
56
+ "should_exist": True,
57
+ "default_content": PYPROJECT_TOML_CONTENT,
58
+ },
59
+ {
60
+ "name": "src",
61
+ "type": DiskItemType.DIRECTORY,
62
+ "should_exist": True,
63
+ "children": [
64
+ {
65
+ "name": "app",
66
+ "type": DiskItemType.DIRECTORY,
67
+ "should_exist": True,
68
+ "children": [
69
+ {
70
+ "name": "__init__.py",
71
+ "type": DiskItemType.FILE,
72
+ "should_exist": True,
73
+ },
74
+ {
75
+ "name": "__main__.py",
76
+ "type": DiskItemType.FILE,
77
+ "should_exist": True,
78
+ "default_content": MAIN_CONTENT,
79
+ },
80
+ ],
81
+ }
82
+ ],
83
+ },
84
+ ]
85
+ }
@@ -0,0 +1,42 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from wexample_wex_core.const.globals import COMMAND_TYPE_SERVICE
6
+ from wexample_wex_core.decorator.command import command
7
+
8
+ if TYPE_CHECKING:
9
+ from wexample_wex_addon_app.service.app_service import AppService
10
+ from wexample_wex_core.context.execution_context import ExecutionContext
11
+
12
+
13
+ @command(
14
+ type=COMMAND_TYPE_SERVICE,
15
+ description="Register docker image build config for the python service",
16
+ )
17
+ def python__service__install(
18
+ context: ExecutionContext,
19
+ service: AppService,
20
+ ) -> None:
21
+ project_name = service.app_workdir.get_project_name()
22
+
23
+ config_file = service.app_workdir.get_config_file()
24
+ config = config_file.read_config()
25
+
26
+ if config.search("docker.images").is_none():
27
+ config.set_by_path(
28
+ "docker.images",
29
+ {
30
+ "base": {
31
+ "dockerfile": ".wex/docker/images/Dockerfile.base",
32
+ "tag": f"{project_name}:local",
33
+ },
34
+ "develop": {
35
+ "dockerfile": ".wex/docker/images/Dockerfile.develop",
36
+ "tag": f"{project_name}-dev:local",
37
+ "depends_on": "base",
38
+ },
39
+ },
40
+ )
41
+ config_file.write_config(config)
42
+ context.io.log(f"Registered docker images for '{project_name}'")
@@ -0,0 +1,58 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from wexample_wex_core.const.globals import COMMAND_TYPE_SERVICE
6
+ from wexample_wex_core.decorator.command import command
7
+
8
+ if TYPE_CHECKING:
9
+ from wexample_wex_addon_app.service.app_service import AppService
10
+ from wexample_wex_core.context.execution_context import ExecutionContext
11
+
12
+
13
+ @command(
14
+ type=COMMAND_TYPE_SERVICE,
15
+ description="Build python docker images if not already built (idempotent via lock)",
16
+ )
17
+ def python__service__setup(
18
+ context: ExecutionContext,
19
+ service: AppService,
20
+ ) -> None:
21
+ import subprocess
22
+
23
+ from wexample_helpers.helpers.file import file_mkdir_as_real_user
24
+ from wexample_wex_addon_app.helpers.image_builds import (
25
+ load_builds,
26
+ resolve_build_order,
27
+ )
28
+
29
+ app_path = service.app_workdir.get_path()
30
+ lock_dir = app_path / ".wex" / "local" / "setup"
31
+ lock_file = lock_dir / "python.done"
32
+
33
+ if lock_file.exists():
34
+ return
35
+
36
+ try:
37
+ builds = load_builds(app_path)
38
+ except (FileNotFoundError, KeyError):
39
+ context.io.log("No docker.images in config.yml, skipping image build")
40
+ return
41
+
42
+ ordered = resolve_build_order(builds)
43
+
44
+ for build_name in ordered:
45
+ build = builds[build_name]
46
+ dockerfile = str(app_path / build["dockerfile"])
47
+ tag = build["tag"]
48
+ cmd = ["docker", "build", "-f", dockerfile, "-t", tag]
49
+ if "depends_on" in build:
50
+ parent_tag = builds[build["depends_on"]]["tag"]
51
+ cmd += ["--build-arg", f"BASE_IMAGE={parent_tag}"]
52
+ cmd.append(str(app_path))
53
+ context.io.log(f"Building image '{build_name}' → {tag}")
54
+ subprocess.run(cmd, check=True)
55
+
56
+ file_mkdir_as_real_user(lock_dir)
57
+ lock_file.write_text("done\n")
58
+ context.io.log("Python setup complete.")
@@ -0,0 +1,2 @@
1
+ filestate:
2
+ python_init: false
@@ -0,0 +1,17 @@
1
+ services:
2
+ python:
3
+ container_name: ${APP_PROJECT_NAME}_python
4
+ image: ${APP_NAME}-dev:local
5
+ build:
6
+ context: ${APP_PATH}
7
+ dockerfile: ${APP_SETUP_PATH}docker/images/Dockerfile.develop
8
+ args:
9
+ BASE_IMAGE: ${APP_NAME}:local
10
+ command: [ "bash", "/opt/app/.wex/docker/entrypoint.sh" ]
11
+ volumes:
12
+ - ${APP_PATH}:/opt/app/
13
+ expose:
14
+ - "8000"
15
+ extends:
16
+ file: ${SERVICE_DEFAULT_COMPOSE}
17
+ service: default
@@ -0,0 +1,5 @@
1
+ services:
2
+ python:
3
+ extends:
4
+ file: ${SERVICE_PYTHON_COMPOSE}
5
+ service: python
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+ set -e
3
+
4
+ exec python -m app
@@ -0,0 +1,16 @@
1
+ FROM python:3.12-bookworm
2
+
3
+ WORKDIR /opt/app/
4
+
5
+ RUN useradd --uid 1000 owner --create-home \
6
+ && adduser owner sudo \
7
+ && mkdir -p /etc/sudoers.d \
8
+ && echo "owner ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/owner
9
+
10
+ RUN pip install --no-cache-dir --upgrade pip setuptools wheel
11
+
12
+ COPY . /opt/app/
13
+
14
+ RUN pip install --no-cache-dir .
15
+
16
+ CMD ["bash"]
@@ -0,0 +1,7 @@
1
+ ARG BASE_IMAGE
2
+ FROM ${BASE_IMAGE:-app:local}
3
+
4
+ RUN pip install --no-cache-dir watchdog>=3.0.0
5
+
6
+ # Reinstall in editable mode so volume-mounted source is always live
7
+ RUN pip install -e /opt/app/
@@ -0,0 +1,8 @@
1
+ name: python
2
+ tags:
3
+ - python
4
+ - dev
5
+ docker:
6
+ compose: docker/docker-compose.yml
7
+ config:
8
+ proxy: true
@@ -481,7 +481,7 @@ class PythonPackageWorkdir(PythonWorkdir):
481
481
  ).get_str_or_none()
482
482
 
483
483
  if not repository_url:
484
- return # PyPI public — published locally, no polling needed
484
+ repository_url = "https://pypi.org"
485
485
 
486
486
  token = self.search_app_or_suite_runtime_config(
487
487
  "pdm.repository.token", default=None
@@ -326,7 +326,9 @@ class PythonWorkdir(WithProfilingPythonWorkdirMixin, CodeBaseWorkdir):
326
326
  text=True,
327
327
  )
328
328
  if result.returncode != 0:
329
- self.log(f"Warning: uv pip compile failed: {result.stderr}")
329
+ raise RuntimeError(
330
+ f"uv pip compile failed for {self.get_path()}:\n{result.stderr}"
331
+ )
330
332
 
331
333
  def _create_init_children_factory(self) -> ChildrenFileFactoryOption:
332
334
  from wexample_filestate.const.disk import DiskItemType
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wexample-wex-addon-dev-python
3
- Version: 7.3.1
3
+ Version: 7.5.0
4
4
  Summary: Python dev addon for wex
5
5
  Author-Email: weeger <contact@wexample.com>
6
6
  License: MIT
@@ -16,7 +16,7 @@ Requires-Dist: networkx
16
16
  Requires-Dist: pylint
17
17
  Requires-Dist: pyright
18
18
  Requires-Dist: wexample-filestate-python>=6.4.0
19
- Requires-Dist: wexample-wex-addon-app>=11.0.0
19
+ Requires-Dist: wexample-wex-addon-app>=11.1.0
20
20
  Provides-Extra: dev
21
21
  Requires-Dist: pytest; extra == "dev"
22
22
  Requires-Dist: pytest-cov; extra == "dev"
@@ -24,7 +24,7 @@ Description-Content-Type: text/markdown
24
24
 
25
25
  # wex_addon_dev_python
26
26
 
27
- Version: 7.3.1
27
+ Version: 7.5.0
28
28
 
29
29
  Python dev addon for wex
30
30
 
@@ -111,7 +111,7 @@ Visit the [Wexample Suite documentation](https://docs.wexample.com) for the comp
111
111
  - pylint:
112
112
  - pyright:
113
113
  - wexample-filestate-python: >=6.4.0
114
- - wexample-wex-addon-app: >=11.0.0
114
+ - wexample-wex-addon-app: >=11.1.0
115
115
 
116
116
  ## Versioning & Compatibility Policy
117
117
 
@@ -1,6 +1,6 @@
1
- wexample_wex_addon_dev_python-7.3.1.dist-info/METADATA,sha256=lA4TAmpuoo7ZBWI8sSAeYxs3l_M1YbYxOZ5gjEfkjTs,11755
2
- wexample_wex_addon_dev_python-7.3.1.dist-info/WHEEL,sha256=Z36eTX6lG3PITRleSd5hAZHCcz52yg3c0JQVxKBbLW0,90
3
- wexample_wex_addon_dev_python-7.3.1.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
1
+ wexample_wex_addon_dev_python-7.5.0.dist-info/METADATA,sha256=ZLYclidh8Sbl7p6NgbzEzcbVu6u4NrBPx_4Ct30krJ8,11755
2
+ wexample_wex_addon_dev_python-7.5.0.dist-info/WHEEL,sha256=Z36eTX6lG3PITRleSd5hAZHCcz52yg3c0JQVxKBbLW0,90
3
+ wexample_wex_addon_dev_python-7.5.0.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
4
4
  wexample_wex_addon_dev_python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  wexample_wex_addon_dev_python/__pycache__/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  wexample_wex_addon_dev_python/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -39,11 +39,28 @@ wexample_wex_addon_dev_python/resources/.wex.yml,sha256=JdIF6nGkFcfi76yZYGlXxeWf
39
39
  wexample_wex_addon_dev_python/resources/docker/Dockerfile.python-profiling,sha256=5ujzXfWNN2nv8qQzCLel6dlOwLQ1XhIGZuqplCNB_vQ,290
40
40
  wexample_wex_addon_dev_python/resources/package_publish_gitlab.yml,sha256=WVMj-DeFedQak5s5FraEnM1Rx1-ut4KgPodvAVv25ZM,304
41
41
  wexample_wex_addon_dev_python/resources/readme_templates/tests.md.j2,sha256=tKLcDwx7jhQkryXIxWr12AK-hKEaP6Rusu2MrluiABs,1289
42
+ wexample_wex_addon_dev_python/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
+ wexample_wex_addon_dev_python/services/python/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
+ wexample_wex_addon_dev_python/services/python/app_service.py,sha256=dZ2FtpiojLHhk5nh8mXd1acCaJQW1gNlFRy0-tUTJJM,2263
45
+ wexample_wex_addon_dev_python/services/python/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
+ wexample_wex_addon_dev_python/services/python/commands/service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
+ wexample_wex_addon_dev_python/services/python/commands/service/install.py,sha256=x9beybjhBUw3qPQB1d5VNs3dxZhCuqOxvW6lbwcev-w,1380
48
+ wexample_wex_addon_dev_python/services/python/commands/service/setup.py,sha256=1WpLBYVu56zCfuh5JK7Z4JGxKroCDvMSjmBasHvhrLE,1840
49
+ wexample_wex_addon_dev_python/services/python/docker/.wex.yml,sha256=JdIF6nGkFcfi76yZYGlXxeWfOK4eAUSV_gAn6i3hk2w,32
50
+ wexample_wex_addon_dev_python/services/python/docker/docker-compose.yml,sha256=zr9jm99KXyhOe1RZJ1nxgwqbi62xTXClvyhtA9jAAFc,463
51
+ wexample_wex_addon_dev_python/services/python/samples/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
+ wexample_wex_addon_dev_python/services/python/samples/docker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
+ wexample_wex_addon_dev_python/services/python/samples/docker/docker-compose.yml,sha256=nhSj3WV8GDFJ-R6PczXfiXwI9qmis7t1Xs-UsjTfs-M,93
54
+ wexample_wex_addon_dev_python/services/python/samples/docker/entrypoint.sh,sha256=CukeXI1tjQmObH3XDoMki7YmT3dD3n_wDlceoqfDcH8,47
55
+ wexample_wex_addon_dev_python/services/python/samples/docker/images/Dockerfile.base,sha256=R7DTQwLHxvMfQgF3EJv3a4hgCmkHa88wQgh7MxTxmhA,342
56
+ wexample_wex_addon_dev_python/services/python/samples/docker/images/Dockerfile.develop,sha256=eZMQhD26K2-x2e7b-LOwmv0lpm5bCY7XFpV2ItSUZQo,192
57
+ wexample_wex_addon_dev_python/services/python/samples/docker/images/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
+ wexample_wex_addon_dev_python/services/python/service.yml,sha256=28gvNQIzZ0T0PBwQLH-Mbn-_T92sbfhXe0tZHMBairs,105
42
59
  wexample_wex_addon_dev_python/workdir/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
60
  wexample_wex_addon_dev_python/workdir/__pycache__/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
61
  wexample_wex_addon_dev_python/workdir/mixin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
62
  wexample_wex_addon_dev_python/workdir/mixin/with_profiling_python_workdir_mixin.py,sha256=rWf_AMq4YM_vvKYZiXyhFeAz2xg0KMt_u-1FJACtvjc,3042
46
- wexample_wex_addon_dev_python/workdir/python_package_workdir.py,sha256=DKTNvxVUDdcDU1w_g7C4DD44CEQc0tK3sgeOe7m0rKQ,19532
63
+ wexample_wex_addon_dev_python/workdir/python_package_workdir.py,sha256=80-N2LtISw9oDUGJgCcXgQktmbVnHkJMpWjnIcyuKSs,19505
47
64
  wexample_wex_addon_dev_python/workdir/python_packages_suite_workdir.py,sha256=ICHHewLpsXiheYzGDEahphBryH98ZVezWzSAy6A5w5I,2874
48
- wexample_wex_addon_dev_python/workdir/python_workdir.py,sha256=56OMSaDHribAQjS5mqT457WJ7R1DnRLDzOBWZHIhMaU,19070
49
- wexample_wex_addon_dev_python-7.3.1.dist-info/RECORD,,
65
+ wexample_wex_addon_dev_python/workdir/python_workdir.py,sha256=wt1Zf4odWR5Lo8qyCSQ1ARjfkyjWKd3-HQ3E4MDBhOI,19124
66
+ wexample_wex_addon_dev_python-7.5.0.dist-info/RECORD,,