wexample-wex-addon-dev-python 0.1.0__tar.gz → 0.2.0__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 (50) hide show
  1. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/PKG-INFO +4 -4
  2. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/README.md +2 -2
  3. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/pyproject.toml +2 -2
  4. wexample_wex_addon_dev_python-0.2.0/src/wexample_wex_addon_dev_python/resources/docker/Dockerfile.python-profiling +11 -0
  5. {wexample_wex_addon_dev_python-0.1.0/src/wexample_wex_addon_dev_python/resources/readme_templates → wexample_wex_addon_dev_python-0.2.0/src/wexample_wex_addon_dev_python/resources/docker}/__init__.py +0 -0
  6. wexample_wex_addon_dev_python-0.2.0/src/wexample_wex_addon_dev_python/workdir/__pycache__/__init__.py +0 -0
  7. wexample_wex_addon_dev_python-0.2.0/src/wexample_wex_addon_dev_python/workdir/mixin/__init__.py +0 -0
  8. wexample_wex_addon_dev_python-0.2.0/src/wexample_wex_addon_dev_python/workdir/mixin/with_profiling_python_workdir_mixin.py +93 -0
  9. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/workdir/python_workdir.py +4 -1
  10. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/__init__.py +0 -0
  11. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/__pycache__/__init__.py +0 -0
  12. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/commands/__init__.py +0 -0
  13. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/commands/code/__init__.py +0 -0
  14. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/commands/code/check/__init__.py +0 -0
  15. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/commands/code/check/mypy.py +0 -0
  16. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/commands/code/check/pylint.py +0 -0
  17. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/commands/code/check/pyright.py +0 -0
  18. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/commands/code/check.py +0 -0
  19. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/commands/code/format/__init__.py +0 -0
  20. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/commands/code/format/black.py +0 -0
  21. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/commands/code/format/isort.py +0 -0
  22. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/commands/code/format.py +0 -0
  23. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/commands/examples/__init__.py +0 -0
  24. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/commands/examples/utils/__init__.py +0 -0
  25. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/commands/examples/utils/some_example_type.py +0 -0
  26. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/commands/examples/validate.py +0 -0
  27. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/commands/release/__init__.py +0 -0
  28. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/config_value/__init__.py +0 -0
  29. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/config_value/__pycache__/__init__.py +0 -0
  30. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/config_value/python_package_readme_config_value.py +0 -0
  31. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/const/__init__.py +0 -0
  32. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/const/__pycache__/__init__.py +0 -0
  33. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/const/package.py +0 -0
  34. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/const/python.py +0 -0
  35. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/file/__init__.py +0 -0
  36. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/file/__pycache__/__init__.py +0 -0
  37. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/file/python_app_iml_file.py +0 -0
  38. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/file/python_pyproject_toml_file.py +0 -0
  39. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/middleware/__init__.py +0 -0
  40. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/middleware/__pycache__/__init__.py +0 -0
  41. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/middleware/each_python_file_middleware.py +0 -0
  42. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/py.typed +0 -0
  43. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/python_addon_manager.py +0 -0
  44. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/resources/__init__.py +0 -0
  45. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/resources/package_publish_gitlab.yml +0 -0
  46. {wexample_wex_addon_dev_python-0.1.0/src/wexample_wex_addon_dev_python/workdir → wexample_wex_addon_dev_python-0.2.0/src/wexample_wex_addon_dev_python/resources/readme_templates}/__init__.py +0 -0
  47. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/resources/readme_templates/tests.md.j2 +0 -0
  48. {wexample_wex_addon_dev_python-0.1.0/src/wexample_wex_addon_dev_python/workdir/__pycache__ → wexample_wex_addon_dev_python-0.2.0/src/wexample_wex_addon_dev_python/workdir}/__init__.py +0 -0
  49. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/workdir/python_package_workdir.py +0 -0
  50. {wexample_wex_addon_dev_python-0.1.0 → wexample_wex_addon_dev_python-0.2.0}/src/wexample_wex_addon_dev_python/workdir/python_packages_suite_workdir.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wexample-wex-addon-dev-python
3
- Version: 0.1.0
3
+ Version: 0.2.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>=0.1.0
19
- Requires-Dist: wexample-wex-addon-app>=1.0.0
19
+ Requires-Dist: wexample-wex-addon-app>=1.2.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: 0.1.0
27
+ Version: 0.2.0
28
28
 
29
29
  Python dev addon for wex
30
30
 
@@ -110,7 +110,7 @@ Visit the [Wexample Suite documentation](https://docs.wexample.com) for the comp
110
110
  - pylint:
111
111
  - pyright:
112
112
  - wexample-filestate-python: >=0.1.0
113
- - wexample-wex-addon-app: >=1.0.0
113
+ - wexample-wex-addon-app: >=1.2.0
114
114
 
115
115
  ## Versioning & Compatibility Policy
116
116
 
@@ -1,6 +1,6 @@
1
1
  # wex_addon_dev_python
2
2
 
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
 
5
5
  Python dev addon for wex
6
6
 
@@ -86,7 +86,7 @@ Visit the [Wexample Suite documentation](https://docs.wexample.com) for the comp
86
86
  - pylint:
87
87
  - pyright:
88
88
  - wexample-filestate-python: >=0.1.0
89
- - wexample-wex-addon-app: >=1.0.0
89
+ - wexample-wex-addon-app: >=1.2.0
90
90
 
91
91
  ## Versioning & Compatibility Policy
92
92
 
@@ -6,7 +6,7 @@ build-backend = "pdm.backend"
6
6
 
7
7
  [project]
8
8
  name = "wexample-wex-addon-dev-python"
9
- version = "0.1.0"
9
+ version = "0.2.0"
10
10
  description = "Python dev addon for wex"
11
11
  authors = [
12
12
  { name = "weeger", email = "contact@wexample.com" },
@@ -25,7 +25,7 @@ dependencies = [
25
25
  "pylint",
26
26
  "pyright",
27
27
  "wexample-filestate-python>=0.1.0",
28
- "wexample-wex-addon-app>=1.0.0",
28
+ "wexample-wex-addon-app>=1.2.0",
29
29
  ]
30
30
 
31
31
  [project.readme]
@@ -0,0 +1,11 @@
1
+ FROM python:3.12-slim
2
+
3
+ RUN pip install --no-cache-dir pytest pytest-benchmark
4
+
5
+ # The container runs as the host user (arbitrary UID/GID via docker run --user).
6
+ # Set HOME to /tmp so pip and other tools have a writable directory.
7
+ ENV HOME=/tmp
8
+
9
+ WORKDIR /app
10
+
11
+ CMD ["tail", "-f", "/dev/null"]
@@ -0,0 +1,93 @@
1
+ from __future__ import annotations
2
+
3
+ from wexample_wex_addon_app.workdir.mixin.abstract_profiling_workdir_mixin import (
4
+ AbstractProfilingWorkdirMixin,
5
+ )
6
+
7
+
8
+ class WithProfilingPythonWorkdirMixin(AbstractProfilingWorkdirMixin):
9
+ """Mixin that adds pytest-benchmark profiling capability to a Python workdir.
10
+
11
+ Runs benchmarks in the workdir's local venv so that local (unpublished)
12
+ dependencies are available — no Docker required.
13
+
14
+ Requires the workdir to have benchmark tests written with pytest-benchmark:
15
+ def test_my_function(benchmark):
16
+ benchmark(my_function, ...)
17
+ """
18
+
19
+ _BENCH_OUTPUT_FILENAME = ".wex_bench.json"
20
+
21
+ def run_profiling(self) -> dict:
22
+ import json
23
+ import subprocess
24
+
25
+ bench_output_path = self.get_path() / self._BENCH_OUTPUT_FILENAME
26
+ python = self._get_profiling_python()
27
+
28
+ bench_result = subprocess.run(
29
+ [
30
+ str(python),
31
+ "-m",
32
+ "pytest",
33
+ self.get_benchmark_dir(),
34
+ "--benchmark-only",
35
+ f"--benchmark-json={bench_output_path}",
36
+ "-q",
37
+ ],
38
+ capture_output=True,
39
+ text=True,
40
+ cwd=str(self.get_path()),
41
+ )
42
+
43
+ if not bench_output_path.exists():
44
+ return {
45
+ "error": (
46
+ "No benchmark output produced.\n"
47
+ f"pytest stdout:\n{bench_result.stdout}\n"
48
+ f"pytest stderr:\n{bench_result.stderr}"
49
+ )
50
+ }
51
+
52
+ try:
53
+ content = bench_output_path.read_text().strip()
54
+ if not content:
55
+ return {
56
+ "error": (
57
+ "No benchmark tests found. Add tests using pytest-benchmark:\n"
58
+ " def test_my_function(benchmark):\n"
59
+ " benchmark(my_function, ...)"
60
+ )
61
+ }
62
+ raw = json.loads(content)
63
+ finally:
64
+ bench_output_path.unlink(missing_ok=True)
65
+
66
+ return self._parse_profiling_output(raw)
67
+
68
+ def _get_profiling_python(self) -> Path:
69
+ import sys
70
+ from pathlib import Path
71
+
72
+ return Path(sys.executable)
73
+
74
+ def _parse_profiling_output(self, raw: dict) -> dict:
75
+ entries = []
76
+ for bench in raw.get("benchmarks", []):
77
+ stats = bench.get("stats", {})
78
+ entries.append(
79
+ {
80
+ "name": bench.get("name"),
81
+ "min_ms": round(stats.get("min", 0) * 1000, 3),
82
+ "mean_ms": round(stats.get("mean", 0) * 1000, 3),
83
+ "median_ms": round(stats.get("median", 0) * 1000, 3),
84
+ "max_ms": round(stats.get("max", 0) * 1000, 3),
85
+ "rounds": stats.get("rounds", 0),
86
+ }
87
+ )
88
+
89
+ return {
90
+ "language": "python",
91
+ "tool": "pytest-benchmark",
92
+ "entries": entries,
93
+ }
@@ -25,6 +25,9 @@ from wexample_wex_addon_dev_python.const.python import (
25
25
  PYTHON_PYTEST_COV_REPORT_DIR,
26
26
  )
27
27
  from wexample_wex_addon_dev_python.file.python_app_iml_file import PythonAppImlFile
28
+ from wexample_wex_addon_dev_python.workdir.mixin.with_profiling_python_workdir_mixin import (
29
+ WithProfilingPythonWorkdirMixin,
30
+ )
28
31
 
29
32
  if TYPE_CHECKING:
30
33
  from wexample_config.const.types import DictConfig
@@ -44,7 +47,7 @@ if TYPE_CHECKING:
44
47
  )
45
48
 
46
49
 
47
- class PythonWorkdir(CodeBaseWorkdir):
50
+ class PythonWorkdir(WithProfilingPythonWorkdirMixin, CodeBaseWorkdir):
48
51
  def app_install(self, env: str | None = None, force: bool = False) -> Path:
49
52
  from wexample_wex_addon_app.helpers.python import (
50
53
  python_ensure_pip_or_fail,