wexample-wex-addon-dev-python 0.0.61__tar.gz → 0.0.62__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 (48) hide show
  1. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/PKG-INFO +72 -14
  2. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/README.md +68 -9
  3. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/pyproject.toml +4 -5
  4. wexample_wex_addon_dev_python-0.0.62/src/wexample_wex_addon_dev_python/config_value/python_package_readme_config_value.py +50 -0
  5. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/const/python.py +0 -0
  6. wexample_wex_addon_dev_python-0.0.62/src/wexample_wex_addon_dev_python/file/python_app_iml_file.py +41 -0
  7. wexample_wex_addon_dev_python-0.0.61/src/wexample_wex_addon_dev_python/file/python_package_toml_file.py → wexample_wex_addon_dev_python-0.0.62/src/wexample_wex_addon_dev_python/file/python_pyproject_toml_file.py +35 -35
  8. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/resources/__init__.py +0 -0
  9. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/resources/readme_templates/__init__.py +0 -0
  10. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/resources/readme_templates/tests.md.j2 +0 -0
  11. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/workdir/python_package_workdir.py +90 -220
  12. wexample_wex_addon_dev_python-0.0.62/src/wexample_wex_addon_dev_python/workdir/python_packages_suite_workdir.py +85 -0
  13. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/workdir/python_workdir.py +63 -67
  14. wexample_wex_addon_dev_python-0.0.61/src/wexample_wex_addon_dev_python/config_value/python_package_readme_config_value.py +0 -249
  15. wexample_wex_addon_dev_python-0.0.61/src/wexample_wex_addon_dev_python/resources/readme_templates/title.md.j2 +0 -5
  16. wexample_wex_addon_dev_python-0.0.61/src/wexample_wex_addon_dev_python/workdir/python_packages_suite_workdir.py +0 -173
  17. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/__init__.py +0 -0
  18. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/__pycache__/__init__.py +0 -0
  19. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/commands/__init__.py +0 -0
  20. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/commands/code/__init__.py +0 -0
  21. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/commands/code/check/__init__.py +0 -0
  22. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/commands/code/check/mypy.py +0 -0
  23. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/commands/code/check/pylint.py +0 -0
  24. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/commands/code/check/pyright.py +0 -0
  25. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/commands/code/check.py +0 -0
  26. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/commands/code/format/__init__.py +0 -0
  27. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/commands/code/format/black.py +0 -0
  28. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/commands/code/format/isort.py +0 -0
  29. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/commands/code/format.py +0 -0
  30. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/commands/examples/__init__.py +0 -0
  31. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/commands/examples/utils/__init__.py +0 -0
  32. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/commands/examples/utils/some_example_type.py +0 -0
  33. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/commands/examples/validate.py +0 -0
  34. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/commands/release/__init__.py +0 -0
  35. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/config_value/__init__.py +0 -0
  36. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/config_value/__pycache__/__init__.py +0 -0
  37. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/const/__init__.py +0 -0
  38. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/const/__pycache__/__init__.py +0 -0
  39. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/const/package.py +0 -0
  40. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/file/__init__.py +0 -0
  41. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/file/__pycache__/__init__.py +0 -0
  42. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/middleware/__init__.py +0 -0
  43. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/middleware/__pycache__/__init__.py +0 -0
  44. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/middleware/each_python_file_middleware.py +0 -0
  45. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/py.typed +0 -0
  46. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/python_addon_manager.py +0 -0
  47. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/workdir/__init__.py +0 -0
  48. {wexample_wex_addon_dev_python-0.0.61 → wexample_wex_addon_dev_python-0.0.62}/src/wexample_wex_addon_dev_python/workdir/__pycache__/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: wexample-wex-addon-dev-python
3
- Version: 0.0.61
3
+ Version: 0.0.62
4
4
  Summary: Python dev addon for wex
5
5
  Author-Email: weeger <contact@wexample.com>
6
6
  License: MIT
@@ -11,13 +11,12 @@ Project-URL: homepage, https://github.com/wexample/python-wex-dev-python
11
11
  Requires-Python: >=3.10
12
12
  Requires-Dist: attrs>=23.1.0
13
13
  Requires-Dist: cattrs>=23.1.0
14
- Requires-Dist: jinja2
15
14
  Requires-Dist: networkx
16
15
  Requires-Dist: pylint
17
16
  Requires-Dist: pyright
18
- Requires-Dist: wexample-filestate-python==0.0.56
19
- Requires-Dist: wexample-wex-addon-app==0.0.53
20
- Requires-Dist: wexample-wex-core==6.0.65
17
+ Requires-Dist: wexample-filestate-python==0.0.57
18
+ Requires-Dist: wexample-wex-addon-app==0.0.54
19
+ Requires-Dist: wexample-wex-core==6.0.66
21
20
  Provides-Extra: dev
22
21
  Requires-Dist: pytest; extra == "dev"
23
22
  Requires-Dist: pytest-cov; extra == "dev"
@@ -25,10 +24,49 @@ Description-Content-Type: text/markdown
25
24
 
26
25
  # wexample-wex-addon-dev-python
27
26
 
28
- Version: 0.0.61
27
+ Version: 0.0.62
29
28
 
30
29
  Python dev addon for wex
31
30
 
31
+ ## Table of Contents
32
+
33
+ - [Status Compatibility](#status-compatibility)
34
+ - [Api Reference](#api-reference)
35
+ - [Tests](#tests)
36
+ - [Code Quality](#code-quality)
37
+ - [Versioning](#versioning)
38
+ - [Changelog](#changelog)
39
+ - [Migration Notes](#migration-notes)
40
+ - [Roadmap](#roadmap)
41
+ - [Security](#security)
42
+ - [Privacy](#privacy)
43
+ - [Support](#support)
44
+ - [Contribution Guidelines](#contribution-guidelines)
45
+ - [Maintainers](#maintainers)
46
+ - [License](#license)
47
+ - [Useful Links](#useful-links)
48
+ - [Suite Integration](#suite-integration)
49
+ - [Compatibility Matrix](#compatibility-matrix)
50
+ - [Dependencies](#dependencies)
51
+ - [Suite Signature](#suite-signature)
52
+
53
+
54
+ ## Status & Compatibility
55
+
56
+ **Maturity**: Production-ready
57
+
58
+ **Python Support**: >=3.10
59
+
60
+ **OS Support**: Linux, macOS, Windows
61
+
62
+ **Status**: Actively maintained
63
+
64
+ ## API Reference
65
+
66
+ Full API documentation is available in the source code docstrings.
67
+
68
+ Key modules and classes are documented with type hints for better IDE support.
69
+
32
70
  ## Tests
33
71
 
34
72
  This project uses `pytest` for testing and `pytest-cov` for code coverage analysis.
@@ -115,13 +153,13 @@ Breaking changes are clearly documented with upgrade paths and examples.
115
153
 
116
154
  Current limitations and planned features are tracked in the GitHub issues.
117
155
 
118
- See the [project roadmap](https://github.com/wexample/python-wex-dev-python/issues) for upcoming features and improvements.
156
+ See the [project roadmap](https://github.com/wexample/python-wex_addon_dev_python/issues) for upcoming features and improvements.
119
157
 
120
158
  ## Security Policy
121
159
 
122
160
  ### Reporting Vulnerabilities
123
161
 
124
- If you discover a security vulnerability, please email security@wexample.com.
162
+ If you discover a security vulnerability, please email contact@wexample.com.
125
163
 
126
164
  **Do not** open public issues for security vulnerabilities.
127
165
 
@@ -144,7 +182,7 @@ Community support is available through GitHub Discussions.
144
182
 
145
183
  ## Contribution Guidelines
146
184
 
147
- We welcome contributions to the Wexample suite!
185
+ We welcome contributions to the Wexample suite!
148
186
 
149
187
  ### How to Contribute
150
188
 
@@ -162,14 +200,16 @@ See [CONTRIBUTORS.md](CONTRIBUTORS.md) for the full list of contributors.
162
200
 
163
201
  ## License
164
202
 
165
- MIT
203
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
204
+
205
+ Free to use in both personal and commercial projects.
166
206
 
167
207
  ## Useful Links
168
208
 
169
- - **Homepage**: https://github.com/wexample/python-wex-dev-python
209
+ - **Homepage**: https://github.com/wexample/python-wex-addon-dev-python
170
210
  - **Documentation**: [docs.wexample.com](https://docs.wexample.com)
171
- - **Issue Tracker**: https://github.com/wexample/python-wex-dev-python/issues
172
- - **Discussions**: https://github.com/wexample/python-wex-dev-python/discussions
211
+ - **Issue Tracker**: https://github.com/wexample/python-wex-addon-dev-python/issues
212
+ - **Discussions**: https://github.com/wexample/python-wex-addon-dev-python/discussions
173
213
  - **PyPI**: [pypi.org/project/wexample-wex-addon-dev-python](https://pypi.org/project/wexample-wex-addon-dev-python/)
174
214
 
175
215
  ## Integration in the Suite
@@ -182,9 +222,27 @@ The suite includes packages for configuration management, file handling, prompts
182
222
 
183
223
  Visit the [Wexample Suite documentation](https://docs.wexample.com) for the complete package ecosystem.
184
224
 
225
+ ## Compatibility Matrix
226
+
227
+ This package is part of the Wexample suite and is compatible with other suite packages.
228
+
229
+ Refer to each package's documentation for specific version compatibility requirements.
230
+
231
+ ## Dependencies
232
+
233
+ - attrs: >=23.1.0
234
+ - cattrs: >=23.1.0
235
+ - networkx:
236
+ - pylint:
237
+ - pyright:
238
+ - wexample-filestate-python: ==0.0.57
239
+ - wexample-wex-addon-app: ==0.0.54
240
+ - wexample-wex-core: ==6.0.66
241
+
242
+
185
243
  # About us
186
244
 
187
- Wexample stands as a cornerstone of the digital ecosystem — a collective of seasoned engineers, researchers, and creators driven by a relentless pursuit of technological excellence. More than a media platform, it has grown into a vibrant community where innovation meets craftsmanship, and where every line of code reflects a commitment to clarity, durability, and shared intelligence.
245
+ [Wexample](https://wexample.com) stands as a cornerstone of the digital ecosystem — a collective of seasoned engineers, researchers, and creators driven by a relentless pursuit of technological excellence. More than a media platform, it has grown into a vibrant community where innovation meets craftsmanship, and where every line of code reflects a commitment to clarity, durability, and shared intelligence.
188
246
 
189
247
  This packages suite embodies this spirit. Trusted by professionals and enthusiasts alike, it delivers a consistent, high-quality foundation for modern development — open, elegant, and battle-tested. Its reputation is built on years of collaboration, refinement, and rigorous attention to detail, making it a natural choice for those who demand both robustness and beauty in their tools.
190
248
 
@@ -1,9 +1,48 @@
1
1
  # wexample-wex-addon-dev-python
2
2
 
3
- Version: 0.0.61
3
+ Version: 0.0.62
4
4
 
5
5
  Python dev addon for wex
6
6
 
7
+ ## Table of Contents
8
+
9
+ - [Status Compatibility](#status-compatibility)
10
+ - [Api Reference](#api-reference)
11
+ - [Tests](#tests)
12
+ - [Code Quality](#code-quality)
13
+ - [Versioning](#versioning)
14
+ - [Changelog](#changelog)
15
+ - [Migration Notes](#migration-notes)
16
+ - [Roadmap](#roadmap)
17
+ - [Security](#security)
18
+ - [Privacy](#privacy)
19
+ - [Support](#support)
20
+ - [Contribution Guidelines](#contribution-guidelines)
21
+ - [Maintainers](#maintainers)
22
+ - [License](#license)
23
+ - [Useful Links](#useful-links)
24
+ - [Suite Integration](#suite-integration)
25
+ - [Compatibility Matrix](#compatibility-matrix)
26
+ - [Dependencies](#dependencies)
27
+ - [Suite Signature](#suite-signature)
28
+
29
+
30
+ ## Status & Compatibility
31
+
32
+ **Maturity**: Production-ready
33
+
34
+ **Python Support**: >=3.10
35
+
36
+ **OS Support**: Linux, macOS, Windows
37
+
38
+ **Status**: Actively maintained
39
+
40
+ ## API Reference
41
+
42
+ Full API documentation is available in the source code docstrings.
43
+
44
+ Key modules and classes are documented with type hints for better IDE support.
45
+
7
46
  ## Tests
8
47
 
9
48
  This project uses `pytest` for testing and `pytest-cov` for code coverage analysis.
@@ -90,13 +129,13 @@ Breaking changes are clearly documented with upgrade paths and examples.
90
129
 
91
130
  Current limitations and planned features are tracked in the GitHub issues.
92
131
 
93
- See the [project roadmap](https://github.com/wexample/python-wex-dev-python/issues) for upcoming features and improvements.
132
+ See the [project roadmap](https://github.com/wexample/python-wex_addon_dev_python/issues) for upcoming features and improvements.
94
133
 
95
134
  ## Security Policy
96
135
 
97
136
  ### Reporting Vulnerabilities
98
137
 
99
- If you discover a security vulnerability, please email security@wexample.com.
138
+ If you discover a security vulnerability, please email contact@wexample.com.
100
139
 
101
140
  **Do not** open public issues for security vulnerabilities.
102
141
 
@@ -119,7 +158,7 @@ Community support is available through GitHub Discussions.
119
158
 
120
159
  ## Contribution Guidelines
121
160
 
122
- We welcome contributions to the Wexample suite!
161
+ We welcome contributions to the Wexample suite!
123
162
 
124
163
  ### How to Contribute
125
164
 
@@ -137,14 +176,16 @@ See [CONTRIBUTORS.md](CONTRIBUTORS.md) for the full list of contributors.
137
176
 
138
177
  ## License
139
178
 
140
- MIT
179
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
180
+
181
+ Free to use in both personal and commercial projects.
141
182
 
142
183
  ## Useful Links
143
184
 
144
- - **Homepage**: https://github.com/wexample/python-wex-dev-python
185
+ - **Homepage**: https://github.com/wexample/python-wex-addon-dev-python
145
186
  - **Documentation**: [docs.wexample.com](https://docs.wexample.com)
146
- - **Issue Tracker**: https://github.com/wexample/python-wex-dev-python/issues
147
- - **Discussions**: https://github.com/wexample/python-wex-dev-python/discussions
187
+ - **Issue Tracker**: https://github.com/wexample/python-wex-addon-dev-python/issues
188
+ - **Discussions**: https://github.com/wexample/python-wex-addon-dev-python/discussions
148
189
  - **PyPI**: [pypi.org/project/wexample-wex-addon-dev-python](https://pypi.org/project/wexample-wex-addon-dev-python/)
149
190
 
150
191
  ## Integration in the Suite
@@ -157,9 +198,27 @@ The suite includes packages for configuration management, file handling, prompts
157
198
 
158
199
  Visit the [Wexample Suite documentation](https://docs.wexample.com) for the complete package ecosystem.
159
200
 
201
+ ## Compatibility Matrix
202
+
203
+ This package is part of the Wexample suite and is compatible with other suite packages.
204
+
205
+ Refer to each package's documentation for specific version compatibility requirements.
206
+
207
+ ## Dependencies
208
+
209
+ - attrs: >=23.1.0
210
+ - cattrs: >=23.1.0
211
+ - networkx:
212
+ - pylint:
213
+ - pyright:
214
+ - wexample-filestate-python: ==0.0.57
215
+ - wexample-wex-addon-app: ==0.0.54
216
+ - wexample-wex-core: ==6.0.66
217
+
218
+
160
219
  # About us
161
220
 
162
- Wexample stands as a cornerstone of the digital ecosystem — a collective of seasoned engineers, researchers, and creators driven by a relentless pursuit of technological excellence. More than a media platform, it has grown into a vibrant community where innovation meets craftsmanship, and where every line of code reflects a commitment to clarity, durability, and shared intelligence.
221
+ [Wexample](https://wexample.com) stands as a cornerstone of the digital ecosystem — a collective of seasoned engineers, researchers, and creators driven by a relentless pursuit of technological excellence. More than a media platform, it has grown into a vibrant community where innovation meets craftsmanship, and where every line of code reflects a commitment to clarity, durability, and shared intelligence.
163
222
 
164
223
  This packages suite embodies this spirit. Trusted by professionals and enthusiasts alike, it delivers a consistent, high-quality foundation for modern development — open, elegant, and battle-tested. Its reputation is built on years of collaboration, refinement, and rigorous attention to detail, making it a natural choice for those who demand both robustness and beauty in their tools.
165
224
 
@@ -6,7 +6,7 @@ build-backend = "pdm.backend"
6
6
 
7
7
  [project]
8
8
  name = "wexample-wex-addon-dev-python"
9
- version = "0.0.61"
9
+ version = "0.0.62"
10
10
  description = "Python dev addon for wex"
11
11
  authors = [
12
12
  { name = "weeger", email = "contact@wexample.com" },
@@ -20,13 +20,12 @@ classifiers = [
20
20
  dependencies = [
21
21
  "attrs>=23.1.0",
22
22
  "cattrs>=23.1.0",
23
- "jinja2",
24
23
  "networkx",
25
24
  "pylint",
26
25
  "pyright",
27
- "wexample-filestate-python==0.0.56",
28
- "wexample-wex-addon-app==0.0.53",
29
- "wexample-wex-core==6.0.65",
26
+ "wexample-filestate-python==0.0.57",
27
+ "wexample-wex-addon-app==0.0.54",
28
+ "wexample-wex-core==6.0.66",
30
29
  ]
31
30
 
32
31
  [project.readme]
@@ -0,0 +1,50 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import TYPE_CHECKING
4
+
5
+ from wexample_helpers.decorator.base_class import base_class
6
+ from wexample_wex_addon_app.config_value.app_readme_config_value import (
7
+ AppReadmeConfigValue,
8
+ )
9
+
10
+ if TYPE_CHECKING:
11
+ pass
12
+
13
+
14
+ @base_class
15
+ class PythonPackageReadmeContentConfigValue(AppReadmeConfigValue):
16
+ """README generation for Python packages."""
17
+
18
+ def _get_app_description(self) -> str:
19
+ """Extract description from pyproject.toml."""
20
+ return self.workdir.get_app_config().get("project", {}).get("description")
21
+
22
+ def _get_app_homepage(self) -> str:
23
+ """Extract homepage URL from pyproject.toml."""
24
+ project = self.workdir.get_app_config()
25
+ urls = (
26
+ project.get("urls", {}) if isinstance(project.get("urls", {}), dict) else {}
27
+ )
28
+ return urls.get("homepage") or urls.get("Homepage") or ""
29
+
30
+ def _get_project_license(self) -> str | None:
31
+ """Extract license information from pyproject.toml."""
32
+ project = self.workdir.get_app_config()
33
+ license_field = project.get("license", {})
34
+ if isinstance(license_field, dict):
35
+ return license_field.get("text", "") or license_field.get("file", "")
36
+ return str(license_field) if license_field else ""
37
+
38
+ def _get_template_context(self) -> dict:
39
+ """Build template context with Python-specific variables.
40
+
41
+ Adds python_version to the base context.
42
+ """
43
+ context = super()._get_template_context()
44
+
45
+ # Add Python-specific variable
46
+ context["python_version"] = (
47
+ self.workdir.get_app_config().get("project", {}).get("requires-python", "")
48
+ )
49
+
50
+ return context
@@ -0,0 +1,41 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Iterable
4
+ from typing import Any, ClassVar
5
+
6
+ from wexample_app.item.file.iml_file import ImlFile
7
+
8
+
9
+ class PythonAppImlFile(ImlFile):
10
+ """
11
+ IntelliJ IDEA .iml helper tailored for Python apps (src/tests layout, python module type).
12
+ """
13
+
14
+ MODULE_TYPE: ClassVar[str] = "PYTHON_MODULE"
15
+
16
+ def _default_exclude_folders(self) -> Iterable[dict[str, Any]]:
17
+ return (
18
+ {
19
+ "@url": f"{self.MODULE_DIR_URL}/dist",
20
+ },
21
+ )
22
+
23
+ def _default_module_attributes(self) -> dict[str, str]:
24
+ attrs = super()._default_module_attributes()
25
+ attrs.setdefault("@type", self.MODULE_TYPE)
26
+ return attrs
27
+
28
+ def _default_order_entries(self) -> Iterable[dict[str, Any]]:
29
+ return ({"@type": "sourceFolder", "@forTests": "false"},)
30
+
31
+ def _default_source_folders(self) -> Iterable[dict[str, Any]]:
32
+ return (
33
+ {
34
+ "@url": f"{self.MODULE_DIR_URL}/src",
35
+ "@isTestSource": "false",
36
+ },
37
+ {
38
+ "@url": f"{self.MODULE_DIR_URL}/tests",
39
+ "@isTestSource": "true",
40
+ },
41
+ )
@@ -14,29 +14,44 @@ if TYPE_CHECKING:
14
14
 
15
15
 
16
16
  @base_class
17
- class PythonPackageTomlFile(TomlFile):
17
+ class PythonPyprojectTomlFile(TomlFile):
18
18
  def add_dependency(
19
- self, spec: str, optional: bool = False, group: str = "dev"
19
+ self,
20
+ package_name: str,
21
+ version: str,
22
+ operator: str = "==",
23
+ optional: bool = False,
24
+ group: None | str = None,
20
25
  ) -> bool:
21
26
  from packaging.requirements import Requirement
22
27
  from packaging.utils import canonicalize_name
23
28
  from wexample_filestate_python.helpers.toml import toml_sort_string_array
24
29
 
25
- deps = self._get_deps_array(optional=optional, group=group)
30
+ spec = f"{package_name}{operator}{version}"
26
31
  new_req = Requirement(spec)
27
32
  new_name = canonicalize_name(new_req.name)
28
33
 
29
- old_spec = None
30
- for dep in deps:
31
- if canonicalize_name(Requirement(dep).name) == new_name:
32
- old_spec = dep
33
- break
34
+ deps = self._get_deps_array(optional=optional, group=group)
35
+
36
+ # Look for existing dependency
37
+ old_spec = next(
38
+ (d for d in deps if canonicalize_name(Requirement(d).name) == new_name),
39
+ None,
40
+ )
34
41
 
35
- self.remove_dependency_by_name(new_name, optional=optional, group=group)
42
+ # Remove old dep if exists
43
+ if old_spec:
44
+ deps.remove(old_spec)
36
45
 
46
+ # Add new version
37
47
  deps.append(spec)
48
+
49
+ # Sort array
38
50
  toml_sort_string_array(deps)
39
51
 
52
+ # Save file
53
+ self.write_parsed()
54
+
40
55
  return old_spec != spec
41
56
 
42
57
  def dumps(self, content: TOMLDocument | dict | None = None) -> str:
@@ -70,35 +85,21 @@ class PythonPackageTomlFile(TomlFile):
70
85
 
71
86
  return self.find_closest(CodeBaseWorkdir)
72
87
 
73
- def list_dependencies(
88
+ def get_dependencies_versions(
74
89
  self, optional: bool = False, group: str = "dev"
75
- ) -> list[str]:
76
- deps = self._get_deps_array(optional=optional, group=group)
77
- return [str(x) for x in list(deps)]
78
-
79
- def list_dependency_names(
80
- self,
81
- canonicalize_names: bool = True,
82
- optional: bool = False,
83
- group: str = "dev",
84
- ) -> list[str]:
85
- """Return dependency package names derived from list_dependencies().
86
-
87
- If canonicalize_names is True, names are normalized using packaging's
88
- canonicalize_name for robust comparisons (dash/underscore, case, etc.).
89
- """
90
+ ) -> dict[str, str]:
90
91
  from packaging.requirements import Requirement
91
92
  from packaging.utils import canonicalize_name
92
93
 
93
- names: list[str] = []
94
- for spec in self.list_dependencies(optional=optional, group=group):
95
- try:
96
- name = Requirement(spec).name
97
- names.append(canonicalize_name(name) if canonicalize_names else name)
98
- except Exception:
99
- # Skip unparsable entries when deriving names
100
- continue
101
- return names
94
+ deps = self._get_deps_array(optional=optional, group=group)
95
+
96
+ map = {}
97
+ for spec in list(deps):
98
+ req = Requirement(spec)
99
+ # name: version
100
+ map[canonicalize_name(req.name)] = str(req.specifier)
101
+
102
+ return map
102
103
 
103
104
  def optional_group_array(self, group: str):
104
105
  """Ensure and return project.optional-dependencies[group] as multi-line array."""
@@ -305,7 +306,6 @@ class PythonPackageTomlFile(TomlFile):
305
306
 
306
307
  toml_sort_string_array(dev_arr)
307
308
 
308
- # --- Unified dependency accessors (runtime vs optional) ---
309
309
  def _get_deps_array(self, optional: bool = False, group: str = "dev"):
310
310
  """Return TOML array for runtime deps or optional group (multiline)."""
311
311
  return (