wexample-wex-addon-dev-flutter 6.8.2__tar.gz → 6.9.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.
- wexample_wex_addon_dev_flutter-6.9.0/PKG-INFO +269 -0
- wexample_wex_addon_dev_flutter-6.9.0/README.md +248 -0
- {wexample_wex_addon_dev_flutter-6.8.2 → wexample_wex_addon_dev_flutter-6.9.0}/pyproject.toml +4 -4
- {wexample_wex_addon_dev_flutter-6.8.2 → wexample_wex_addon_dev_flutter-6.9.0}/src/wexample_wex_addon_dev_flutter/config_value/flutter_package_readme_config_value.py +5 -2
- wexample_wex_addon_dev_flutter-6.9.0/src/wexample_wex_addon_dev_flutter/flutter_addon_manager.py +22 -0
- wexample_wex_addon_dev_flutter-6.9.0/tests/.gitkeep +0 -0
- wexample_wex_addon_dev_flutter-6.8.2/PKG-INFO +0 -473
- wexample_wex_addon_dev_flutter-6.8.2/README.md +0 -452
- wexample_wex_addon_dev_flutter-6.8.2/src/wexample_wex_addon_dev_flutter/flutter_addon_manager.py +0 -7
- {wexample_wex_addon_dev_flutter-6.8.2 → wexample_wex_addon_dev_flutter-6.9.0}/src/wexample_wex_addon_dev_flutter/__init__.py +0 -0
- {wexample_wex_addon_dev_flutter-6.8.2 → wexample_wex_addon_dev_flutter-6.9.0}/src/wexample_wex_addon_dev_flutter/__pycache__/__init__.py +0 -0
- {wexample_wex_addon_dev_flutter-6.8.2 → wexample_wex_addon_dev_flutter-6.9.0}/src/wexample_wex_addon_dev_flutter/config_value/__init__.py +0 -0
- {wexample_wex_addon_dev_flutter-6.8.2 → wexample_wex_addon_dev_flutter-6.9.0}/src/wexample_wex_addon_dev_flutter/file/__init__.py +0 -0
- {wexample_wex_addon_dev_flutter-6.8.2 → wexample_wex_addon_dev_flutter-6.9.0}/src/wexample_wex_addon_dev_flutter/file/flutter_pubspec_yaml_file.py +0 -0
- {wexample_wex_addon_dev_flutter-6.8.2 → wexample_wex_addon_dev_flutter-6.9.0}/src/wexample_wex_addon_dev_flutter/py.typed +0 -0
- {wexample_wex_addon_dev_flutter-6.8.2 → wexample_wex_addon_dev_flutter-6.9.0}/src/wexample_wex_addon_dev_flutter/workdir/__init__.py +0 -0
- {wexample_wex_addon_dev_flutter-6.8.2 → wexample_wex_addon_dev_flutter-6.9.0}/src/wexample_wex_addon_dev_flutter/workdir/flutter_package_workdir.py +0 -0
- {wexample_wex_addon_dev_flutter-6.8.2 → wexample_wex_addon_dev_flutter-6.9.0}/src/wexample_wex_addon_dev_flutter/workdir/flutter_packages_suite_workdir.py +0 -0
- {wexample_wex_addon_dev_flutter-6.8.2 → wexample_wex_addon_dev_flutter-6.9.0}/src/wexample_wex_addon_dev_flutter/workdir/flutter_workdir.py +0 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: wexample-wex-addon-dev-flutter
|
|
3
|
+
Version: 6.9.0
|
|
4
|
+
Summary: Extends wex with Flutter workdir types that enforce project file structure, auto-format Dart sources, and publish packages via flutter pub publish
|
|
5
|
+
Author-Email: weeger <contact@wexample.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Project-URL: homepage, https://github.com/wexample/python-wex-dev-python
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Requires-Dist: attrs>=23.1.0
|
|
13
|
+
Requires-Dist: cattrs>=23.1.0
|
|
14
|
+
Requires-Dist: wexample-filestate-flutter>=6.6.0
|
|
15
|
+
Requires-Dist: wexample-wex-addon-ai>=13.0.0
|
|
16
|
+
Requires-Dist: wexample-wex-addon-app>=30.0.0
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: pytest; extra == "dev"
|
|
19
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# wex_addon_dev_flutter
|
|
23
|
+
|
|
24
|
+
Version: 6.9.0
|
|
25
|
+
|
|
26
|
+
A wex addon for developers who maintain Flutter and Dart packages: it registers three workdir types — `flutter`, `flutter-package`, and `flutter-packages-suite` — that enforce the expected directory layout (`pubspec.yaml`, `lib/`, `test/`, `.publignore`), auto-format every `.dart` file via `dart format`, and drive `flutter pub publish` for releases. The `flutter-package` workdir also keeps `pubspec.yaml` consistent, writing the package name, version, and GitHub URLs resolved from the repository remote.
|
|
27
|
+
|
|
28
|
+
## Table of Contents
|
|
29
|
+
|
|
30
|
+
- [Installation](#installation)
|
|
31
|
+
- [Quickstart](#quickstart)
|
|
32
|
+
- [Tests](#tests)
|
|
33
|
+
- [Architecture](#architecture)
|
|
34
|
+
- [Integration in the Suite](#integration-in-the-suite)
|
|
35
|
+
- [Dependencies](#dependencies)
|
|
36
|
+
- [Versioning & Compatibility Policy](#versioning--compatibility-policy)
|
|
37
|
+
- [License](#license)
|
|
38
|
+
- [About us](#about-us)
|
|
39
|
+
- [Known Limitations & Roadmap](#known-limitations--roadmap)
|
|
40
|
+
- [Status & Compatibility](#status--compatibility)
|
|
41
|
+
- [Useful Links](#useful-links)
|
|
42
|
+
- [Migration Notes](#migration-notes)
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install wexample-wex-addon-dev-flutter
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Requires Python >=3.10.
|
|
51
|
+
|
|
52
|
+
## Quickstart
|
|
53
|
+
|
|
54
|
+
Install the package:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install wexample-wex-addon-dev-flutter
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The public entry point is `FlutterAddonManager`, defined in src/wexample_wex_addon_dev_flutter/flutter_addon_manager.py:
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from wexample_wex_addon_dev_flutter.flutter_addon_manager import FlutterAddonManager
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Pass it to the kernel's `setup()` call to register the Flutter workdir types:
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from wexample_wex_core.common.kernel import Kernel
|
|
70
|
+
|
|
71
|
+
kernel = Kernel()
|
|
72
|
+
kernel.setup(addons=[FlutterAddonManager])
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
After `setup()` returns, the kernel recognises three workdir types — `flutter`, `flutter-package`, and `flutter-packages-suite` — mapped by `get_workdir_types()`. A `flutter` workdir enforces the presence of `pubspec.yaml`, `lib/`, `test/`, and `.publignore`, and applies `dart format` to every `.dart` file it finds under `lib/` and `test/`. A `flutter-package` workdir extends that with auto-generated `pubspec.yaml` metadata (name, version, homepage, repository, and issue tracker resolved from the Git remote) and README generation. A `flutter-packages-suite` workdir treats each subdirectory that contains a `pubspec.yaml` as a `flutter-package` child.
|
|
76
|
+
|
|
77
|
+
The manager carries no CLI commands; registering it is the registration.
|
|
78
|
+
|
|
79
|
+
## Tests
|
|
80
|
+
|
|
81
|
+
This project uses `pytest` for testing and `pytest-cov` for code coverage analysis.
|
|
82
|
+
|
|
83
|
+
### Installation
|
|
84
|
+
|
|
85
|
+
First, install the required testing dependencies:
|
|
86
|
+
```bash
|
|
87
|
+
.venv/bin/python -m pip install pytest pytest-cov
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Basic Usage
|
|
91
|
+
|
|
92
|
+
Run all tests with coverage:
|
|
93
|
+
```bash
|
|
94
|
+
.venv/bin/python -m pytest --cov --cov-report=html
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Common Commands
|
|
98
|
+
```bash
|
|
99
|
+
# Run tests with coverage for a specific module
|
|
100
|
+
.venv/bin/python -m pytest --cov=your_module
|
|
101
|
+
|
|
102
|
+
# Show which lines are not covered
|
|
103
|
+
.venv/bin/python -m pytest --cov=your_module --cov-report=term-missing
|
|
104
|
+
|
|
105
|
+
# Generate an HTML coverage report
|
|
106
|
+
.venv/bin/python -m pytest --cov=your_module --cov-report=html
|
|
107
|
+
|
|
108
|
+
# Combine terminal and HTML reports
|
|
109
|
+
.venv/bin/python -m pytest --cov=your_module --cov-report=term-missing --cov-report=html
|
|
110
|
+
|
|
111
|
+
# Run specific test file with coverage
|
|
112
|
+
.venv/bin/python -m pytest tests/test_file.py --cov=your_module --cov-report=term-missing
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Viewing HTML Reports
|
|
116
|
+
|
|
117
|
+
After generating an HTML report, open `htmlcov/index.html` in your browser to view detailed line-by-line coverage information.
|
|
118
|
+
|
|
119
|
+
### Coverage Threshold
|
|
120
|
+
|
|
121
|
+
To enforce a minimum coverage percentage:
|
|
122
|
+
```bash
|
|
123
|
+
.venv/bin/python -m pytest --cov=your_module --cov-fail-under=80
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
This will cause the test suite to fail if coverage drops below 80%.
|
|
127
|
+
|
|
128
|
+
## Architecture
|
|
129
|
+
|
|
130
|
+
The addon is a thin Python package whose only job is to extend the wex kernel with Flutter-aware workdir types. No CLI commands are added; registration is the feature.
|
|
131
|
+
|
|
132
|
+
### Entry point
|
|
133
|
+
|
|
134
|
+
src/wexample_wex_addon_dev_flutter/flutter_addon_manager.py defines `FlutterAddonManager`, which extends `AbstractAddonManager` from `wexample_wex_core`. Its sole method, `get_workdir_types()`, returns the mapping the kernel uses to resolve workdir type strings at runtime:
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
{
|
|
138
|
+
"flutter": FlutterWorkdir,
|
|
139
|
+
"flutter-package": FlutterPackageWorkdir,
|
|
140
|
+
"flutter-packages-suite": FlutterPackagesSuiteWorkdir,
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
All three workdir classes are imported lazily inside `get_workdir_types()` to avoid circular imports at module load time.
|
|
145
|
+
|
|
146
|
+
### Workdir hierarchy
|
|
147
|
+
|
|
148
|
+
#### `FlutterWorkdir`
|
|
149
|
+
|
|
150
|
+
src/wexample_wex_addon_dev_flutter/workdir/flutter_workdir.py is the base class for both Flutter workdir types. It inherits `CodeBaseWorkdir` (from `wexample-wex-addon-app`), `WithAiWorkdirMixin`, and `WithLicenseWorkdirMixin`.
|
|
151
|
+
|
|
152
|
+
`prepare_value()` is where the expected on-disk structure is declared. It appends to the filestate children list:
|
|
153
|
+
|
|
154
|
+
- `pubspec.yaml` — mapped to `FlutterPubspecYamlFile`, required to exist.
|
|
155
|
+
- `lib/` and `test/` — required directories; each carries a `ChildrenFilterOption` that matches every `*.dart` file (recursively) and attaches `DartFormatOption` to it, so `dart format` runs on every Dart source the filestate visits.
|
|
156
|
+
- `.publignore` — required to exist.
|
|
157
|
+
- A `.gitignore` section named `Flutter` covering `.dart_tool/`, `build/`, `.packages`, and the platform-specific plugin manifests.
|
|
158
|
+
|
|
159
|
+
`get_options_providers()` appends `FlutterOptionsProvider` from `wexample-filestate-flutter` to the list returned by the parent, which is how Dart-specific filestate options become available to the tree.
|
|
160
|
+
|
|
161
|
+
`get_app_config_file()` returns the `FlutterPubspecYamlFile` child, reading it once so its content is populated.
|
|
162
|
+
|
|
163
|
+
`_publish()` shells out to `flutter pub publish --dry-run` first, then `flutter pub publish`, routing through `_safe_shell()` which swallows exit code 65 (pub's warning-only exit) and re-raises everything else.
|
|
164
|
+
|
|
165
|
+
#### `FlutterPackageWorkdir`
|
|
166
|
+
|
|
167
|
+
src/wexample_wex_addon_dev_flutter/workdir/flutter_package_workdir.py extends `FlutterWorkdir` with package-specific behaviour:
|
|
168
|
+
|
|
169
|
+
- `_get_critical_directories()` declares `lib/` as the one directory whose absence is a hard error.
|
|
170
|
+
- `_get_readme_content()` returns a `FlutterPackageReadmeContentConfigValue` instance, wiring in Flutter-specific README generation.
|
|
171
|
+
- `_get_suite_workdir_class()` returns `FlutterPackagesSuiteWorkdir`, so the suite layer knows which class to use when walking a multi-package repository.
|
|
172
|
+
|
|
173
|
+
#### `FlutterPackagesSuiteWorkdir`
|
|
174
|
+
|
|
175
|
+
src/wexample_wex_addon_dev_flutter/workdir/flutter_packages_suite_workdir.py extends `FrameworkPackageSuiteWorkdir` from `wexample-wex-addon-app`. It identifies child package directories by checking for the presence of `pubspec.yaml` (`_child_is_package_directory()`), names the child workdir type `"flutter"` (`_get_children_package_directory_name()`), and hands back `FlutterPackageWorkdir` as the class to instantiate for each child (`_get_children_package_workdir_class()`).
|
|
176
|
+
|
|
177
|
+
### File model
|
|
178
|
+
|
|
179
|
+
src/wexample_wex_addon_dev_flutter/file/flutter_pubspec_yaml_file.py extends `YamlFile`. Its `dumps()` method is called whenever the filestate writes the file to disk. It:
|
|
180
|
+
|
|
181
|
+
1. Sets `name` from `workdir.get_package_name()` and `version` from `workdir.get_setup_version()`.
|
|
182
|
+
2. Resolves the deployment remote URL via `git remote get-url`.
|
|
183
|
+
3. If the remote is a GitHub URL, fills in `homepage`, `repository`, and `issue_tracker` (only where those keys are absent in the current content).
|
|
184
|
+
|
|
185
|
+
`get_dependencies_versions()` reads `dependencies` and, when `group="dev"`, merges `dev_dependencies` on top, returning a flat `dict[str, str]`.
|
|
186
|
+
|
|
187
|
+
### README generation
|
|
188
|
+
|
|
189
|
+
src/wexample_wex_addon_dev_flutter/config_value/flutter_package_readme_config_value.py extends `AppReadmeConfigValue`. The only override is `_get_app_description()`, which reads the `description` field from `pubspec.yaml` (via `workdir.get_app_config()`) and falls back to the parent implementation when that field is absent.
|
|
190
|
+
|
|
191
|
+
### Call path for a filestate apply
|
|
192
|
+
|
|
193
|
+
1. The kernel resolves `"flutter-package"` → `FlutterPackageWorkdir` via `FlutterAddonManager.get_workdir_types()`.
|
|
194
|
+
2. `FlutterPackageWorkdir.prepare_value()` (inherited from `FlutterWorkdir`) builds the expected tree, declaring `pubspec.yaml`, `lib/`, `test/`, `.publignore`, and the gitignore block.
|
|
195
|
+
3. For each `*.dart` file under `lib/` or `test/`, the `ChildrenFilterOption` attaches `DartFormatOption`; the filestate runner calls `dart format` on it.
|
|
196
|
+
4. When the filestate visits `pubspec.yaml`, it delegates to `FlutterPubspecYamlFile.dumps()`, which writes name, version, and GitHub URLs.
|
|
197
|
+
5. `_get_readme_content()` returns a `FlutterPackageReadmeContentConfigValue` whose `_get_app_description()` pulls the description from the freshly resolved `pubspec.yaml`.
|
|
198
|
+
|
|
199
|
+
## Integration in the Suite
|
|
200
|
+
|
|
201
|
+
This package is part of the Wexample Suite — a collection of high-quality, modular tools designed to work seamlessly together across multiple languages and environments.
|
|
202
|
+
|
|
203
|
+
### Related Packages
|
|
204
|
+
|
|
205
|
+
The suite includes packages for configuration management, file handling, prompts, and more. Each package can be used independently or as part of the integrated suite.
|
|
206
|
+
|
|
207
|
+
Visit the [Wexample Suite documentation](https://docs.wexample.com) for the complete package ecosystem.
|
|
208
|
+
|
|
209
|
+
## Dependencies
|
|
210
|
+
|
|
211
|
+
- attrs: >=23.1.0
|
|
212
|
+
- cattrs: >=23.1.0
|
|
213
|
+
- wexample-filestate-flutter: >=6.6.0
|
|
214
|
+
- wexample-wex-addon-ai: >=13.0.0
|
|
215
|
+
- wexample-wex-addon-app: >=30.0.0
|
|
216
|
+
|
|
217
|
+
## Versioning & Compatibility Policy
|
|
218
|
+
|
|
219
|
+
Wexample packages follow **Semantic Versioning** (SemVer):
|
|
220
|
+
|
|
221
|
+
- **MAJOR**: Breaking changes
|
|
222
|
+
- **MINOR**: New features, backward compatible
|
|
223
|
+
- **PATCH**: Bug fixes, backward compatible
|
|
224
|
+
|
|
225
|
+
We maintain backward compatibility within major versions and provide clear migration guides for breaking changes.
|
|
226
|
+
|
|
227
|
+
## License
|
|
228
|
+
|
|
229
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
230
|
+
|
|
231
|
+
Free to use in both personal and commercial projects.
|
|
232
|
+
|
|
233
|
+
## About us
|
|
234
|
+
|
|
235
|
+
[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.
|
|
236
|
+
|
|
237
|
+
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.
|
|
238
|
+
|
|
239
|
+
Wexample cultivates a culture of mastery. Each package, each contribution carries the mark of a community that values precision, ethics, and innovation — a community proud to shape the future of digital craftsmanship.
|
|
240
|
+
|
|
241
|
+
## Known Limitations & Roadmap
|
|
242
|
+
|
|
243
|
+
Current limitations and planned features are tracked in the GitHub issues.
|
|
244
|
+
|
|
245
|
+
See the [project roadmap](https://github.com/wexample/python-wex_addon_dev_flutter/issues) for upcoming features and improvements.
|
|
246
|
+
|
|
247
|
+
## Status & Compatibility
|
|
248
|
+
|
|
249
|
+
**Maturity**: Production-ready
|
|
250
|
+
|
|
251
|
+
**Python Support**: >=3.10
|
|
252
|
+
|
|
253
|
+
**OS Support**: Linux, macOS, Windows
|
|
254
|
+
|
|
255
|
+
**Status**: Actively maintained
|
|
256
|
+
|
|
257
|
+
## Useful Links
|
|
258
|
+
|
|
259
|
+
- **Homepage**: https://github.com/wexample/python-wex-addon-dev-flutter
|
|
260
|
+
- **Documentation**: [docs.wexample.com](https://docs.wexample.com)
|
|
261
|
+
- **Issue Tracker**: https://github.com/wexample/python-wex-addon-dev-flutter/issues
|
|
262
|
+
- **Discussions**: https://github.com/wexample/python-wex-addon-dev-flutter/discussions
|
|
263
|
+
- **PyPI**: [pypi.org/project/wexample-wex-addon-dev-flutter](https://pypi.org/project/wexample-wex-addon-dev-flutter/)
|
|
264
|
+
|
|
265
|
+
## Migration Notes
|
|
266
|
+
|
|
267
|
+
When upgrading between major versions, refer to the migration guides in the documentation.
|
|
268
|
+
|
|
269
|
+
Breaking changes are clearly documented with upgrade paths and examples.
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# wex_addon_dev_flutter
|
|
2
|
+
|
|
3
|
+
Version: 6.9.0
|
|
4
|
+
|
|
5
|
+
A wex addon for developers who maintain Flutter and Dart packages: it registers three workdir types — `flutter`, `flutter-package`, and `flutter-packages-suite` — that enforce the expected directory layout (`pubspec.yaml`, `lib/`, `test/`, `.publignore`), auto-format every `.dart` file via `dart format`, and drive `flutter pub publish` for releases. The `flutter-package` workdir also keeps `pubspec.yaml` consistent, writing the package name, version, and GitHub URLs resolved from the repository remote.
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
- [Installation](#installation)
|
|
10
|
+
- [Quickstart](#quickstart)
|
|
11
|
+
- [Tests](#tests)
|
|
12
|
+
- [Architecture](#architecture)
|
|
13
|
+
- [Integration in the Suite](#integration-in-the-suite)
|
|
14
|
+
- [Dependencies](#dependencies)
|
|
15
|
+
- [Versioning & Compatibility Policy](#versioning--compatibility-policy)
|
|
16
|
+
- [License](#license)
|
|
17
|
+
- [About us](#about-us)
|
|
18
|
+
- [Known Limitations & Roadmap](#known-limitations--roadmap)
|
|
19
|
+
- [Status & Compatibility](#status--compatibility)
|
|
20
|
+
- [Useful Links](#useful-links)
|
|
21
|
+
- [Migration Notes](#migration-notes)
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install wexample-wex-addon-dev-flutter
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Requires Python >=3.10.
|
|
30
|
+
|
|
31
|
+
## Quickstart
|
|
32
|
+
|
|
33
|
+
Install the package:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install wexample-wex-addon-dev-flutter
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The public entry point is `FlutterAddonManager`, defined in src/wexample_wex_addon_dev_flutter/flutter_addon_manager.py:
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from wexample_wex_addon_dev_flutter.flutter_addon_manager import FlutterAddonManager
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Pass it to the kernel's `setup()` call to register the Flutter workdir types:
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
from wexample_wex_core.common.kernel import Kernel
|
|
49
|
+
|
|
50
|
+
kernel = Kernel()
|
|
51
|
+
kernel.setup(addons=[FlutterAddonManager])
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
After `setup()` returns, the kernel recognises three workdir types — `flutter`, `flutter-package`, and `flutter-packages-suite` — mapped by `get_workdir_types()`. A `flutter` workdir enforces the presence of `pubspec.yaml`, `lib/`, `test/`, and `.publignore`, and applies `dart format` to every `.dart` file it finds under `lib/` and `test/`. A `flutter-package` workdir extends that with auto-generated `pubspec.yaml` metadata (name, version, homepage, repository, and issue tracker resolved from the Git remote) and README generation. A `flutter-packages-suite` workdir treats each subdirectory that contains a `pubspec.yaml` as a `flutter-package` child.
|
|
55
|
+
|
|
56
|
+
The manager carries no CLI commands; registering it is the registration.
|
|
57
|
+
|
|
58
|
+
## Tests
|
|
59
|
+
|
|
60
|
+
This project uses `pytest` for testing and `pytest-cov` for code coverage analysis.
|
|
61
|
+
|
|
62
|
+
### Installation
|
|
63
|
+
|
|
64
|
+
First, install the required testing dependencies:
|
|
65
|
+
```bash
|
|
66
|
+
.venv/bin/python -m pip install pytest pytest-cov
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Basic Usage
|
|
70
|
+
|
|
71
|
+
Run all tests with coverage:
|
|
72
|
+
```bash
|
|
73
|
+
.venv/bin/python -m pytest --cov --cov-report=html
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Common Commands
|
|
77
|
+
```bash
|
|
78
|
+
# Run tests with coverage for a specific module
|
|
79
|
+
.venv/bin/python -m pytest --cov=your_module
|
|
80
|
+
|
|
81
|
+
# Show which lines are not covered
|
|
82
|
+
.venv/bin/python -m pytest --cov=your_module --cov-report=term-missing
|
|
83
|
+
|
|
84
|
+
# Generate an HTML coverage report
|
|
85
|
+
.venv/bin/python -m pytest --cov=your_module --cov-report=html
|
|
86
|
+
|
|
87
|
+
# Combine terminal and HTML reports
|
|
88
|
+
.venv/bin/python -m pytest --cov=your_module --cov-report=term-missing --cov-report=html
|
|
89
|
+
|
|
90
|
+
# Run specific test file with coverage
|
|
91
|
+
.venv/bin/python -m pytest tests/test_file.py --cov=your_module --cov-report=term-missing
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Viewing HTML Reports
|
|
95
|
+
|
|
96
|
+
After generating an HTML report, open `htmlcov/index.html` in your browser to view detailed line-by-line coverage information.
|
|
97
|
+
|
|
98
|
+
### Coverage Threshold
|
|
99
|
+
|
|
100
|
+
To enforce a minimum coverage percentage:
|
|
101
|
+
```bash
|
|
102
|
+
.venv/bin/python -m pytest --cov=your_module --cov-fail-under=80
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
This will cause the test suite to fail if coverage drops below 80%.
|
|
106
|
+
|
|
107
|
+
## Architecture
|
|
108
|
+
|
|
109
|
+
The addon is a thin Python package whose only job is to extend the wex kernel with Flutter-aware workdir types. No CLI commands are added; registration is the feature.
|
|
110
|
+
|
|
111
|
+
### Entry point
|
|
112
|
+
|
|
113
|
+
src/wexample_wex_addon_dev_flutter/flutter_addon_manager.py defines `FlutterAddonManager`, which extends `AbstractAddonManager` from `wexample_wex_core`. Its sole method, `get_workdir_types()`, returns the mapping the kernel uses to resolve workdir type strings at runtime:
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
{
|
|
117
|
+
"flutter": FlutterWorkdir,
|
|
118
|
+
"flutter-package": FlutterPackageWorkdir,
|
|
119
|
+
"flutter-packages-suite": FlutterPackagesSuiteWorkdir,
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
All three workdir classes are imported lazily inside `get_workdir_types()` to avoid circular imports at module load time.
|
|
124
|
+
|
|
125
|
+
### Workdir hierarchy
|
|
126
|
+
|
|
127
|
+
#### `FlutterWorkdir`
|
|
128
|
+
|
|
129
|
+
src/wexample_wex_addon_dev_flutter/workdir/flutter_workdir.py is the base class for both Flutter workdir types. It inherits `CodeBaseWorkdir` (from `wexample-wex-addon-app`), `WithAiWorkdirMixin`, and `WithLicenseWorkdirMixin`.
|
|
130
|
+
|
|
131
|
+
`prepare_value()` is where the expected on-disk structure is declared. It appends to the filestate children list:
|
|
132
|
+
|
|
133
|
+
- `pubspec.yaml` — mapped to `FlutterPubspecYamlFile`, required to exist.
|
|
134
|
+
- `lib/` and `test/` — required directories; each carries a `ChildrenFilterOption` that matches every `*.dart` file (recursively) and attaches `DartFormatOption` to it, so `dart format` runs on every Dart source the filestate visits.
|
|
135
|
+
- `.publignore` — required to exist.
|
|
136
|
+
- A `.gitignore` section named `Flutter` covering `.dart_tool/`, `build/`, `.packages`, and the platform-specific plugin manifests.
|
|
137
|
+
|
|
138
|
+
`get_options_providers()` appends `FlutterOptionsProvider` from `wexample-filestate-flutter` to the list returned by the parent, which is how Dart-specific filestate options become available to the tree.
|
|
139
|
+
|
|
140
|
+
`get_app_config_file()` returns the `FlutterPubspecYamlFile` child, reading it once so its content is populated.
|
|
141
|
+
|
|
142
|
+
`_publish()` shells out to `flutter pub publish --dry-run` first, then `flutter pub publish`, routing through `_safe_shell()` which swallows exit code 65 (pub's warning-only exit) and re-raises everything else.
|
|
143
|
+
|
|
144
|
+
#### `FlutterPackageWorkdir`
|
|
145
|
+
|
|
146
|
+
src/wexample_wex_addon_dev_flutter/workdir/flutter_package_workdir.py extends `FlutterWorkdir` with package-specific behaviour:
|
|
147
|
+
|
|
148
|
+
- `_get_critical_directories()` declares `lib/` as the one directory whose absence is a hard error.
|
|
149
|
+
- `_get_readme_content()` returns a `FlutterPackageReadmeContentConfigValue` instance, wiring in Flutter-specific README generation.
|
|
150
|
+
- `_get_suite_workdir_class()` returns `FlutterPackagesSuiteWorkdir`, so the suite layer knows which class to use when walking a multi-package repository.
|
|
151
|
+
|
|
152
|
+
#### `FlutterPackagesSuiteWorkdir`
|
|
153
|
+
|
|
154
|
+
src/wexample_wex_addon_dev_flutter/workdir/flutter_packages_suite_workdir.py extends `FrameworkPackageSuiteWorkdir` from `wexample-wex-addon-app`. It identifies child package directories by checking for the presence of `pubspec.yaml` (`_child_is_package_directory()`), names the child workdir type `"flutter"` (`_get_children_package_directory_name()`), and hands back `FlutterPackageWorkdir` as the class to instantiate for each child (`_get_children_package_workdir_class()`).
|
|
155
|
+
|
|
156
|
+
### File model
|
|
157
|
+
|
|
158
|
+
src/wexample_wex_addon_dev_flutter/file/flutter_pubspec_yaml_file.py extends `YamlFile`. Its `dumps()` method is called whenever the filestate writes the file to disk. It:
|
|
159
|
+
|
|
160
|
+
1. Sets `name` from `workdir.get_package_name()` and `version` from `workdir.get_setup_version()`.
|
|
161
|
+
2. Resolves the deployment remote URL via `git remote get-url`.
|
|
162
|
+
3. If the remote is a GitHub URL, fills in `homepage`, `repository`, and `issue_tracker` (only where those keys are absent in the current content).
|
|
163
|
+
|
|
164
|
+
`get_dependencies_versions()` reads `dependencies` and, when `group="dev"`, merges `dev_dependencies` on top, returning a flat `dict[str, str]`.
|
|
165
|
+
|
|
166
|
+
### README generation
|
|
167
|
+
|
|
168
|
+
src/wexample_wex_addon_dev_flutter/config_value/flutter_package_readme_config_value.py extends `AppReadmeConfigValue`. The only override is `_get_app_description()`, which reads the `description` field from `pubspec.yaml` (via `workdir.get_app_config()`) and falls back to the parent implementation when that field is absent.
|
|
169
|
+
|
|
170
|
+
### Call path for a filestate apply
|
|
171
|
+
|
|
172
|
+
1. The kernel resolves `"flutter-package"` → `FlutterPackageWorkdir` via `FlutterAddonManager.get_workdir_types()`.
|
|
173
|
+
2. `FlutterPackageWorkdir.prepare_value()` (inherited from `FlutterWorkdir`) builds the expected tree, declaring `pubspec.yaml`, `lib/`, `test/`, `.publignore`, and the gitignore block.
|
|
174
|
+
3. For each `*.dart` file under `lib/` or `test/`, the `ChildrenFilterOption` attaches `DartFormatOption`; the filestate runner calls `dart format` on it.
|
|
175
|
+
4. When the filestate visits `pubspec.yaml`, it delegates to `FlutterPubspecYamlFile.dumps()`, which writes name, version, and GitHub URLs.
|
|
176
|
+
5. `_get_readme_content()` returns a `FlutterPackageReadmeContentConfigValue` whose `_get_app_description()` pulls the description from the freshly resolved `pubspec.yaml`.
|
|
177
|
+
|
|
178
|
+
## Integration in the Suite
|
|
179
|
+
|
|
180
|
+
This package is part of the Wexample Suite — a collection of high-quality, modular tools designed to work seamlessly together across multiple languages and environments.
|
|
181
|
+
|
|
182
|
+
### Related Packages
|
|
183
|
+
|
|
184
|
+
The suite includes packages for configuration management, file handling, prompts, and more. Each package can be used independently or as part of the integrated suite.
|
|
185
|
+
|
|
186
|
+
Visit the [Wexample Suite documentation](https://docs.wexample.com) for the complete package ecosystem.
|
|
187
|
+
|
|
188
|
+
## Dependencies
|
|
189
|
+
|
|
190
|
+
- attrs: >=23.1.0
|
|
191
|
+
- cattrs: >=23.1.0
|
|
192
|
+
- wexample-filestate-flutter: >=6.6.0
|
|
193
|
+
- wexample-wex-addon-ai: >=13.0.0
|
|
194
|
+
- wexample-wex-addon-app: >=30.0.0
|
|
195
|
+
|
|
196
|
+
## Versioning & Compatibility Policy
|
|
197
|
+
|
|
198
|
+
Wexample packages follow **Semantic Versioning** (SemVer):
|
|
199
|
+
|
|
200
|
+
- **MAJOR**: Breaking changes
|
|
201
|
+
- **MINOR**: New features, backward compatible
|
|
202
|
+
- **PATCH**: Bug fixes, backward compatible
|
|
203
|
+
|
|
204
|
+
We maintain backward compatibility within major versions and provide clear migration guides for breaking changes.
|
|
205
|
+
|
|
206
|
+
## License
|
|
207
|
+
|
|
208
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
209
|
+
|
|
210
|
+
Free to use in both personal and commercial projects.
|
|
211
|
+
|
|
212
|
+
## About us
|
|
213
|
+
|
|
214
|
+
[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.
|
|
215
|
+
|
|
216
|
+
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.
|
|
217
|
+
|
|
218
|
+
Wexample cultivates a culture of mastery. Each package, each contribution carries the mark of a community that values precision, ethics, and innovation — a community proud to shape the future of digital craftsmanship.
|
|
219
|
+
|
|
220
|
+
## Known Limitations & Roadmap
|
|
221
|
+
|
|
222
|
+
Current limitations and planned features are tracked in the GitHub issues.
|
|
223
|
+
|
|
224
|
+
See the [project roadmap](https://github.com/wexample/python-wex_addon_dev_flutter/issues) for upcoming features and improvements.
|
|
225
|
+
|
|
226
|
+
## Status & Compatibility
|
|
227
|
+
|
|
228
|
+
**Maturity**: Production-ready
|
|
229
|
+
|
|
230
|
+
**Python Support**: >=3.10
|
|
231
|
+
|
|
232
|
+
**OS Support**: Linux, macOS, Windows
|
|
233
|
+
|
|
234
|
+
**Status**: Actively maintained
|
|
235
|
+
|
|
236
|
+
## Useful Links
|
|
237
|
+
|
|
238
|
+
- **Homepage**: https://github.com/wexample/python-wex-addon-dev-flutter
|
|
239
|
+
- **Documentation**: [docs.wexample.com](https://docs.wexample.com)
|
|
240
|
+
- **Issue Tracker**: https://github.com/wexample/python-wex-addon-dev-flutter/issues
|
|
241
|
+
- **Discussions**: https://github.com/wexample/python-wex-addon-dev-flutter/discussions
|
|
242
|
+
- **PyPI**: [pypi.org/project/wexample-wex-addon-dev-flutter](https://pypi.org/project/wexample-wex-addon-dev-flutter/)
|
|
243
|
+
|
|
244
|
+
## Migration Notes
|
|
245
|
+
|
|
246
|
+
When upgrading between major versions, refer to the migration guides in the documentation.
|
|
247
|
+
|
|
248
|
+
Breaking changes are clearly documented with upgrade paths and examples.
|
{wexample_wex_addon_dev_flutter-6.8.2 → wexample_wex_addon_dev_flutter-6.9.0}/pyproject.toml
RENAMED
|
@@ -6,8 +6,8 @@ build-backend = "pdm.backend"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "wexample-wex-addon-dev-flutter"
|
|
9
|
-
version = "6.
|
|
10
|
-
description = "
|
|
9
|
+
version = "6.9.0"
|
|
10
|
+
description = "Extends wex with Flutter workdir types that enforce project file structure, auto-format Dart sources, and publish packages via flutter pub publish"
|
|
11
11
|
authors = [
|
|
12
12
|
{ name = "weeger", email = "contact@wexample.com" },
|
|
13
13
|
]
|
|
@@ -21,8 +21,8 @@ dependencies = [
|
|
|
21
21
|
"attrs>=23.1.0",
|
|
22
22
|
"cattrs>=23.1.0",
|
|
23
23
|
"wexample-filestate-flutter>=6.6.0",
|
|
24
|
-
"wexample-wex-addon-ai>=
|
|
25
|
-
"wexample-wex-addon-app>=
|
|
24
|
+
"wexample-wex-addon-ai>=13.0.0",
|
|
25
|
+
"wexample-wex-addon-app>=30.0.0",
|
|
26
26
|
]
|
|
27
27
|
|
|
28
28
|
[project.readme]
|
|
@@ -10,5 +10,8 @@ from wexample_wex_addon_app.config_value.app_readme_config_value import (
|
|
|
10
10
|
class FlutterPackageReadmeContentConfigValue(AppReadmeConfigValue):
|
|
11
11
|
"""README generation for Flutter packages."""
|
|
12
12
|
|
|
13
|
-
def _get_app_description(self) -> str:
|
|
14
|
-
return
|
|
13
|
+
def _get_app_description(self) -> str | None:
|
|
14
|
+
return (
|
|
15
|
+
self.workdir.get_app_config().get("description")
|
|
16
|
+
or super()._get_app_description()
|
|
17
|
+
)
|
wexample_wex_addon_dev_flutter-6.9.0/src/wexample_wex_addon_dev_flutter/flutter_addon_manager.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from wexample_wex_core.common.abstract_addon_manager import AbstractAddonManager
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class FlutterAddonManager(AbstractAddonManager):
|
|
7
|
+
def get_workdir_types(self) -> dict[str, type]:
|
|
8
|
+
from wexample_wex_addon_dev_flutter.workdir.flutter_package_workdir import (
|
|
9
|
+
FlutterPackageWorkdir,
|
|
10
|
+
)
|
|
11
|
+
from wexample_wex_addon_dev_flutter.workdir.flutter_packages_suite_workdir import (
|
|
12
|
+
FlutterPackagesSuiteWorkdir,
|
|
13
|
+
)
|
|
14
|
+
from wexample_wex_addon_dev_flutter.workdir.flutter_workdir import (
|
|
15
|
+
FlutterWorkdir,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
"flutter": FlutterWorkdir,
|
|
20
|
+
"flutter-package": FlutterPackageWorkdir,
|
|
21
|
+
"flutter-packages-suite": FlutterPackagesSuiteWorkdir,
|
|
22
|
+
}
|
|
File without changes
|