wexample-wex-addon-dev-python 0.0.48__py3-none-any.whl → 0.0.53__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.
- wexample_wex_addon_dev_python/__pycache__/__init__.py +0 -0
- wexample_wex_addon_dev_python/commands/code/check.py +1 -0
- wexample_wex_addon_dev_python/config_value/__pycache__/__init__.py +0 -0
- wexample_wex_addon_dev_python/config_value/python_package_readme_config_value.py +193 -36
- wexample_wex_addon_dev_python/const/__pycache__/__init__.py +0 -0
- wexample_wex_addon_dev_python/file/__pycache__/__init__.py +0 -0
- wexample_wex_addon_dev_python/file/python_package_toml_file.py +249 -152
- wexample_wex_addon_dev_python/middleware/__pycache__/__init__.py +0 -0
- wexample_wex_addon_dev_python/resources/__init__.py +0 -0
- wexample_wex_addon_dev_python/resources/readme_templates/__init__.py +0 -0
- wexample_wex_addon_dev_python/resources/readme_templates/tests.md.j2 +48 -0
- wexample_wex_addon_dev_python/resources/readme_templates/title.md.j2 +5 -0
- wexample_wex_addon_dev_python/workdir/__pycache__/__init__.py +0 -0
- wexample_wex_addon_dev_python/workdir/python_package_workdir.py +227 -60
- wexample_wex_addon_dev_python/workdir/python_packages_suite_workdir.py +24 -14
- wexample_wex_addon_dev_python/workdir/python_workdir.py +183 -61
- wexample_wex_addon_dev_python-0.0.53.dist-info/METADATA +192 -0
- {wexample_wex_addon_dev_python-0.0.48.dist-info → wexample_wex_addon_dev_python-0.0.53.dist-info}/RECORD +20 -10
- wexample_wex_addon_dev_python-0.0.48.dist-info/METADATA +0 -60
- {wexample_wex_addon_dev_python-0.0.48.dist-info → wexample_wex_addon_dev_python-0.0.53.dist-info}/WHEEL +0 -0
- {wexample_wex_addon_dev_python-0.0.48.dist-info → wexample_wex_addon_dev_python-0.0.53.dist-info}/entry_points.txt +0 -0
|
File without changes
|
|
@@ -44,6 +44,7 @@ def python__code__check(
|
|
|
44
44
|
) -> bool:
|
|
45
45
|
"""Check a Python file using various code quality tools."""
|
|
46
46
|
from wexample_app.response.failure_response import FailureResponse
|
|
47
|
+
|
|
47
48
|
from wexample_wex_addon_dev_python.commands.code.check.mypy import _code_check_mypy
|
|
48
49
|
from wexample_wex_addon_dev_python.commands.code.check.pylint import (
|
|
49
50
|
_code_check_pylint,
|
|
File without changes
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import os
|
|
4
3
|
from typing import TYPE_CHECKING
|
|
5
4
|
|
|
6
5
|
from wexample_filestate.config_value.readme_content_config_value import (
|
|
@@ -8,9 +7,6 @@ from wexample_filestate.config_value.readme_content_config_value import (
|
|
|
8
7
|
)
|
|
9
8
|
from wexample_helpers.classes.field import public_field
|
|
10
9
|
from wexample_helpers.decorator.base_class import base_class
|
|
11
|
-
from wexample_wex_addon_dev_python.workdir.python_package_workdir import (
|
|
12
|
-
PythonPackageWorkdir,
|
|
13
|
-
)
|
|
14
10
|
|
|
15
11
|
if TYPE_CHECKING:
|
|
16
12
|
from wexample_wex_addon_dev_python.workdir.python_package_workdir import (
|
|
@@ -25,6 +21,71 @@ class PythonPackageReadmeContentConfigValue(ReadmeContentConfigValue):
|
|
|
25
21
|
)
|
|
26
22
|
|
|
27
23
|
def get_templates(self) -> list[str] | None:
|
|
24
|
+
# Prepare context for Jinja2 rendering
|
|
25
|
+
context = self._get_template_context()
|
|
26
|
+
|
|
27
|
+
# Define fixed order of README sections
|
|
28
|
+
section_names = [
|
|
29
|
+
"title",
|
|
30
|
+
"table-of-contents",
|
|
31
|
+
"status-compatibility",
|
|
32
|
+
"prerequisites",
|
|
33
|
+
"installation",
|
|
34
|
+
"quickstart",
|
|
35
|
+
"basic-usage",
|
|
36
|
+
"configuration",
|
|
37
|
+
"logging",
|
|
38
|
+
"api-reference",
|
|
39
|
+
"examples",
|
|
40
|
+
"tests",
|
|
41
|
+
"code-quality",
|
|
42
|
+
"versioning",
|
|
43
|
+
"changelog",
|
|
44
|
+
"migration-notes",
|
|
45
|
+
"roadmap",
|
|
46
|
+
"troubleshooting",
|
|
47
|
+
"security",
|
|
48
|
+
"privacy",
|
|
49
|
+
"support",
|
|
50
|
+
"contribution-guidelines",
|
|
51
|
+
"maintainers",
|
|
52
|
+
"license",
|
|
53
|
+
"useful-links",
|
|
54
|
+
"suite-integration",
|
|
55
|
+
"compatibility-matrix",
|
|
56
|
+
"requirements",
|
|
57
|
+
"dependencies",
|
|
58
|
+
"links",
|
|
59
|
+
"suite-signature",
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
# First pass: collect available sections (excluding title and table-of-contents)
|
|
63
|
+
available_sections = []
|
|
64
|
+
for section_name in section_names:
|
|
65
|
+
if section_name not in ["title", "table-of-contents"]:
|
|
66
|
+
# Check if section exists
|
|
67
|
+
if self._section_exists(section_name):
|
|
68
|
+
available_sections.append(
|
|
69
|
+
{
|
|
70
|
+
"name": section_name,
|
|
71
|
+
"title": self._section_name_to_title(section_name),
|
|
72
|
+
"anchor": section_name.replace("_", "-"),
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
# Add available sections to context for table-of-contents
|
|
77
|
+
context["available_sections"] = available_sections
|
|
78
|
+
|
|
79
|
+
# Render ordered sections (supports both .md and .md.j2)
|
|
80
|
+
rendered_content = ""
|
|
81
|
+
for section_name in section_names:
|
|
82
|
+
section_content = self._render_readme_section(section_name, context)
|
|
83
|
+
if section_content:
|
|
84
|
+
rendered_content += f"{section_content}\n\n"
|
|
85
|
+
|
|
86
|
+
return [rendered_content]
|
|
87
|
+
|
|
88
|
+
def _get_template_context(self) -> dict:
|
|
28
89
|
# Use TOMLDocument from the workdir
|
|
29
90
|
doc = self.workdir.get_project_config()
|
|
30
91
|
project = doc.get("project", {}) if isinstance(doc, dict) else {}
|
|
@@ -49,44 +110,140 @@ class PythonPackageReadmeContentConfigValue(ReadmeContentConfigValue):
|
|
|
49
110
|
# Format dependencies list
|
|
50
111
|
deps_list = "\n".join([f"- {dep}" for dep in dependencies])
|
|
51
112
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"```bash\n"
|
|
64
|
-
f"pip install {package_name}\n"
|
|
65
|
-
"```\n\n"
|
|
66
|
-
f'{self._add_section_if_exists("usage")}'
|
|
67
|
-
"## Links\n\n"
|
|
68
|
-
f"- Homepage: {homepage}\n\n"
|
|
69
|
-
"## License\n\n"
|
|
70
|
-
f"{license_info}"
|
|
71
|
-
]
|
|
113
|
+
return {
|
|
114
|
+
"package_name": self.workdir.get_package_name(),
|
|
115
|
+
"version": self.workdir.get_project_version(),
|
|
116
|
+
"description": description,
|
|
117
|
+
"python_version": python_version,
|
|
118
|
+
"dependencies": dependencies,
|
|
119
|
+
"deps_list": deps_list,
|
|
120
|
+
"homepage": homepage,
|
|
121
|
+
"license_info": license_info,
|
|
122
|
+
"workdir": self.workdir,
|
|
123
|
+
}
|
|
72
124
|
|
|
73
|
-
def
|
|
125
|
+
def _render_readme_section(self, section_name: str, context: dict) -> str | None:
|
|
74
126
|
"""
|
|
75
|
-
|
|
127
|
+
Render a README section from .md or .md.j2 file with Jinja2 support.
|
|
128
|
+
|
|
129
|
+
Searches in three levels (in order):
|
|
130
|
+
1. Package-level templates
|
|
131
|
+
2. Suite-level templates
|
|
132
|
+
3. Default templates (bundled with the module)
|
|
133
|
+
|
|
134
|
+
Tries .md.j2 first, then .md. Both formats support Jinja2 variables.
|
|
135
|
+
|
|
136
|
+
Args:
|
|
137
|
+
section_name: Name of the section (without extension)
|
|
138
|
+
context: Jinja2 context variables for rendering
|
|
139
|
+
|
|
140
|
+
Returns:
|
|
141
|
+
Rendered content or None if section file not found
|
|
76
142
|
"""
|
|
77
|
-
|
|
143
|
+
from pathlib import Path
|
|
144
|
+
|
|
145
|
+
from jinja2 import Environment, FileSystemLoader, TemplateNotFound
|
|
146
|
+
from wexample_app.const.globals import WORKDIR_SETUP_DIR
|
|
147
|
+
|
|
148
|
+
workdir_path = self.workdir.get_path()
|
|
149
|
+
|
|
150
|
+
search_paths = [
|
|
151
|
+
workdir_path / WORKDIR_SETUP_DIR / "knowledge" / "readme", # Package-level
|
|
152
|
+
]
|
|
153
|
+
|
|
154
|
+
# Package may have a suite.
|
|
155
|
+
suite_path = self.workdir.find_suite_workdir_path()
|
|
156
|
+
if suite_path is not None:
|
|
157
|
+
search_paths.append(
|
|
158
|
+
suite_path
|
|
159
|
+
/ WORKDIR_SETUP_DIR
|
|
160
|
+
/ "knowledge"
|
|
161
|
+
/ "package-readme", # Suite-level
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
# Add default templates path (bundled with the module)
|
|
165
|
+
default_templates_path = (
|
|
166
|
+
Path(__file__).parent.parent / "resources" / "readme_templates"
|
|
167
|
+
)
|
|
168
|
+
search_paths.append(default_templates_path)
|
|
169
|
+
|
|
170
|
+
# Try .md.j2 first (Jinja2 template)
|
|
171
|
+
for search_path in search_paths:
|
|
172
|
+
if not search_path.exists():
|
|
173
|
+
continue
|
|
174
|
+
|
|
175
|
+
env = Environment(loader=FileSystemLoader(str(search_path)))
|
|
176
|
+
try:
|
|
177
|
+
template = env.get_template(f"{section_name}.md.j2")
|
|
178
|
+
return template.render(context)
|
|
179
|
+
except TemplateNotFound:
|
|
180
|
+
pass
|
|
78
181
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
182
|
+
# Try .md (static markdown, still rendered with Jinja2)
|
|
183
|
+
for search_path in search_paths:
|
|
184
|
+
md_path = search_path / f"{section_name}.md"
|
|
185
|
+
if md_path.exists():
|
|
186
|
+
content = md_path.read_text(encoding="utf-8")
|
|
187
|
+
env = Environment(loader=FileSystemLoader(str(search_path)))
|
|
188
|
+
template = env.from_string(content)
|
|
189
|
+
return template.render(context)
|
|
83
190
|
|
|
84
|
-
return
|
|
191
|
+
return None
|
|
85
192
|
|
|
86
|
-
def
|
|
193
|
+
def _section_exists(self, section_name: str) -> bool:
|
|
87
194
|
"""
|
|
88
|
-
|
|
195
|
+
Check if a section file exists (.md or .md.j2).
|
|
196
|
+
|
|
197
|
+
Searches in three levels:
|
|
198
|
+
1. Package-level templates
|
|
199
|
+
2. Suite-level templates
|
|
200
|
+
3. Default templates (bundled with the module)
|
|
201
|
+
|
|
202
|
+
Args:
|
|
203
|
+
section_name: Name of the section (without extension)
|
|
204
|
+
|
|
205
|
+
Returns:
|
|
206
|
+
True if section file exists, False otherwise
|
|
89
207
|
"""
|
|
90
|
-
|
|
91
|
-
|
|
208
|
+
from pathlib import Path
|
|
209
|
+
|
|
210
|
+
from wexample_app.const.globals import WORKDIR_SETUP_DIR
|
|
211
|
+
|
|
212
|
+
workdir_path = self.workdir.get_path()
|
|
213
|
+
|
|
214
|
+
search_paths = [
|
|
215
|
+
workdir_path / WORKDIR_SETUP_DIR / "knowledge" / "readme",
|
|
216
|
+
]
|
|
217
|
+
|
|
218
|
+
# Package may have a suite.
|
|
219
|
+
suite_path = self.workdir.find_suite_workdir_path()
|
|
220
|
+
if suite_path is not None:
|
|
221
|
+
search_paths.append(
|
|
222
|
+
suite_path / WORKDIR_SETUP_DIR / "knowledge" / "package-readme",
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
# Add default templates path (bundled with the module)
|
|
226
|
+
default_templates_path = (
|
|
227
|
+
Path(__file__).parent.parent / "resources" / "readme_templates"
|
|
92
228
|
)
|
|
229
|
+
search_paths.append(default_templates_path)
|
|
230
|
+
|
|
231
|
+
for search_path in search_paths:
|
|
232
|
+
if (search_path / f"{section_name}.md.j2").exists():
|
|
233
|
+
return True
|
|
234
|
+
if (search_path / f"{section_name}.md").exists():
|
|
235
|
+
return True
|
|
236
|
+
|
|
237
|
+
return False
|
|
238
|
+
|
|
239
|
+
def _section_name_to_title(self, section_name: str) -> str:
|
|
240
|
+
"""
|
|
241
|
+
Convert section name to human-readable title.
|
|
242
|
+
|
|
243
|
+
Args:
|
|
244
|
+
section_name: Section name (e.g., "basic-usage")
|
|
245
|
+
|
|
246
|
+
Returns:
|
|
247
|
+
Human-readable title (e.g., "Basic Usage")
|
|
248
|
+
"""
|
|
249
|
+
return section_name.replace("-", " ").replace("_", " ").title()
|
|
File without changes
|
|
File without changes
|