wexample-wex-addon-dev-python 7.9.0__py3-none-any.whl → 8.0.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.
File without changes
@@ -0,0 +1,20 @@
1
+ from __future__ import annotations
2
+
3
+
4
+ def apply_pdm_bin_dir(value: str) -> None:
5
+ import os
6
+
7
+ if value not in os.environ.get("PATH", ""):
8
+ os.environ["PATH"] = f"{value}:{os.environ.get('PATH', '')}"
9
+
10
+
11
+ def detect_pdm_bin_dir() -> str | None:
12
+ import pathlib
13
+ import shutil
14
+
15
+ if shutil.which("pdm"):
16
+ return None
17
+ local_bin = pathlib.Path.home() / ".local" / "bin"
18
+ if (local_bin / "pdm").is_file():
19
+ return str(local_bin)
20
+ return None
@@ -9,6 +9,21 @@ if TYPE_CHECKING:
9
9
 
10
10
 
11
11
  class PythonAddonManager(AbstractAddonManager):
12
+ def get_local_configurable_keys(self) -> list[dict]:
13
+ from wexample_wex_addon_dev_python.helpers.pdm import (
14
+ apply_pdm_bin_dir,
15
+ detect_pdm_bin_dir,
16
+ )
17
+
18
+ return [
19
+ {
20
+ "key": "PDM_BIN_DIR",
21
+ "description": "Directory containing pdm — required to publish Python packages",
22
+ "detect": detect_pdm_bin_dir,
23
+ "on_apply": apply_pdm_bin_dir,
24
+ }
25
+ ]
26
+
12
27
  def get_middlewares_classes(self) -> list[type[AbstractMiddleware]]:
13
28
  from wexample_wex_addon_dev_python.middleware.each_python_file_middleware import (
14
29
  EachPythonFileMiddleware,
@@ -45,7 +45,7 @@ if __name__ == "__main__":
45
45
 
46
46
 
47
47
  class AppService(BaseAppService):
48
- def get_workdir_contribution(self) -> dict:
48
+ def get_workdir_contribution(self, workdir) -> dict:
49
49
  from wexample_filestate.const.disk import DiskItemType
50
50
 
51
51
  return {
@@ -26,8 +26,6 @@ class PythonPackageWorkdir(PythonWorkdir):
26
26
  _project_info_cache = None
27
27
 
28
28
  def check_publish_prerequisites(self) -> None:
29
- import os
30
- import pathlib
31
29
  import shutil
32
30
 
33
31
  super().check_publish_prerequisites()
@@ -42,40 +40,10 @@ class PythonPackageWorkdir(PythonWorkdir):
42
40
  f"Run: sudo rm -rf '{pdm_build_dir}'"
43
41
  )
44
42
 
45
- # os.environ.get() intentional: PDM_BIN_DIR may not be in every workdir's
46
- # .wex/local/env.yml — get_env_parameter() raises KeyNotFoundError if absent.
47
- saved_pdm_dir = os.environ.get("PDM_BIN_DIR")
48
- if saved_pdm_dir:
49
- current = os.environ.get("PATH", "")
50
- if saved_pdm_dir not in current:
51
- os.environ["PATH"] = f"{saved_pdm_dir}:{current}"
52
-
53
- if shutil.which("pdm"):
54
- return
55
-
56
- self.warning("'pdm' not found in PATH — required to publish Python packages.")
57
-
58
- local_bin = pathlib.Path.home() / ".local" / "bin"
59
- suggestion = str(local_bin) if (local_bin / "pdm").is_file() else None
60
-
61
- response = self.io.input(
62
- question="Enter the directory containing pdm (will be prepended to PATH):",
63
- default_value=suggestion,
64
- ).get_value()
65
-
66
- if not response:
67
- raise RuntimeError(
68
- "'pdm' not configured. Install it with: pipx install pdm"
69
- )
70
-
71
- os.environ["PATH"] = f"{response}:{os.environ.get('PATH', '')}"
72
- self._persist_env_value("PDM_BIN_DIR", response)
73
- self.info(f"Added {response!r} to PATH — saved to .wex/local/env.yml")
74
-
75
43
  if not shutil.which("pdm"):
76
44
  raise RuntimeError(
77
- f"'pdm' still not found after adding {response!r} to PATH. "
78
- "Check that pdm is installed in that directory."
45
+ "'pdm' not found in PATH.\n"
46
+ "Install: pipx install pdm then run: wex core::env/configure"
79
47
  )
80
48
 
81
49
  def prepare_value(self, raw_value: DictConfig | None = None) -> DictConfig:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wexample-wex-addon-dev-python
3
- Version: 7.9.0
3
+ Version: 8.0.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>=14.1.0
19
+ Requires-Dist: wexample-wex-addon-app>=15.0.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.9.0
27
+ Version: 8.0.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: >=14.1.0
114
+ - wexample-wex-addon-app: >=15.0.0
115
115
 
116
116
  ## Versioning & Compatibility Policy
117
117
 
@@ -1,6 +1,6 @@
1
- wexample_wex_addon_dev_python-7.9.0.dist-info/METADATA,sha256=kdRR0PKXm4oJuK2q8bgqnZ8qqnMqKS4s9LlC7K8hobw,11755
2
- wexample_wex_addon_dev_python-7.9.0.dist-info/WHEEL,sha256=Z36eTX6lG3PITRleSd5hAZHCcz52yg3c0JQVxKBbLW0,90
3
- wexample_wex_addon_dev_python-7.9.0.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
1
+ wexample_wex_addon_dev_python-8.0.0.dist-info/METADATA,sha256=6CXBSbsiv7AOzjVsqka76xPsgQIsRJa3V2PQwrdxiTE,11755
2
+ wexample_wex_addon_dev_python-8.0.0.dist-info/WHEEL,sha256=Z36eTX6lG3PITRleSd5hAZHCcz52yg3c0JQVxKBbLW0,90
3
+ wexample_wex_addon_dev_python-8.0.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
@@ -30,18 +30,20 @@ wexample_wex_addon_dev_python/file/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQe
30
30
  wexample_wex_addon_dev_python/file/__pycache__/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
31
  wexample_wex_addon_dev_python/file/python_app_iml_file.py,sha256=l6YHEILxSGFjOvYWY20zIyAODjOIfuyHsuCfSMw0jVE,1201
32
32
  wexample_wex_addon_dev_python/file/python_pyproject_toml_file.py,sha256=31KcRaewYzK1mHYFLSltyZ9WhuEzV98I5vllmmGWGkU,15952
33
+ wexample_wex_addon_dev_python/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
+ wexample_wex_addon_dev_python/helpers/pdm.py,sha256=s2j7qs7S2OBKjRuXM5URfPrzqksqKZceKgUR2kHmMCk,479
33
35
  wexample_wex_addon_dev_python/middleware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
36
  wexample_wex_addon_dev_python/middleware/__pycache__/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
37
  wexample_wex_addon_dev_python/middleware/each_python_file_middleware.py,sha256=UzNEpedCYf31aNONFl0SuSJnoXRzhJhgEiTCaPark6E,2311
36
38
  wexample_wex_addon_dev_python/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
- wexample_wex_addon_dev_python/python_addon_manager.py,sha256=Mmr9F5lOS2gbb8JTB4-vTri4Qn5Cd2Jukjk7uiTr1Hs,582
39
+ wexample_wex_addon_dev_python/python_addon_manager.py,sha256=iIpn77H4aw9Q0PBtb5BrbjRJMoXXjD6rLsFu7oZ-Ykw,1063
38
40
  wexample_wex_addon_dev_python/resources/.wex.yml,sha256=JdIF6nGkFcfi76yZYGlXxeWfOK4eAUSV_gAn6i3hk2w,32
39
41
  wexample_wex_addon_dev_python/resources/docker/Dockerfile.python-profiling,sha256=5ujzXfWNN2nv8qQzCLel6dlOwLQ1XhIGZuqplCNB_vQ,290
40
42
  wexample_wex_addon_dev_python/resources/package_publish_gitlab.yml,sha256=WVMj-DeFedQak5s5FraEnM1Rx1-ut4KgPodvAVv25ZM,304
41
43
  wexample_wex_addon_dev_python/resources/readme_templates/tests.md.j2,sha256=tKLcDwx7jhQkryXIxWr12AK-hKEaP6Rusu2MrluiABs,1289
42
44
  wexample_wex_addon_dev_python/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
45
  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
46
+ wexample_wex_addon_dev_python/services/python/app_service.py,sha256=OeM7f-IHm7lfS2graCBVAjjqxK_lEiQRmfl9mSEqoP0,2272
45
47
  wexample_wex_addon_dev_python/services/python/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
48
  wexample_wex_addon_dev_python/services/python/commands/service/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
49
  wexample_wex_addon_dev_python/services/python/commands/service/install.py,sha256=gqGfT9mbdutBfIiLKAqJLZuSc4n0YR1huANC9sCoMdA,1590
@@ -60,7 +62,7 @@ wexample_wex_addon_dev_python/workdir/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCe
60
62
  wexample_wex_addon_dev_python/workdir/__pycache__/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
61
63
  wexample_wex_addon_dev_python/workdir/mixin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
62
64
  wexample_wex_addon_dev_python/workdir/mixin/with_profiling_python_workdir_mixin.py,sha256=rWf_AMq4YM_vvKYZiXyhFeAz2xg0KMt_u-1FJACtvjc,3042
63
- wexample_wex_addon_dev_python/workdir/python_package_workdir.py,sha256=MeTw4C6i3ug8g9BB0D1SjW8-VkRFD08TYhrrkW6LFD4,20127
65
+ wexample_wex_addon_dev_python/workdir/python_package_workdir.py,sha256=PUKvtY4DbUyFBLJSA4lVGVcMOoF9V377yFUgUOgMPfE,18839
64
66
  wexample_wex_addon_dev_python/workdir/python_packages_suite_workdir.py,sha256=ICHHewLpsXiheYzGDEahphBryH98ZVezWzSAy6A5w5I,2874
65
67
  wexample_wex_addon_dev_python/workdir/python_workdir.py,sha256=BCFARcJAAU8pidcB_3m4OIgIC0nmWYvwBW6FBT25HsM,19154
66
- wexample_wex_addon_dev_python-7.9.0.dist-info/RECORD,,
68
+ wexample_wex_addon_dev_python-8.0.0.dist-info/RECORD,,