flaskit-cli 0.2.1__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.
- flaskit/__init__.py +13 -0
- flaskit/__main__.py +6 -0
- flaskit/cli.py +294 -0
- flaskit/templates/module/blueprint.py.j2 +10 -0
- flaskit/templates/module/resource.py.j2 +48 -0
- flaskit/templates/module/schema.py.j2 +9 -0
- flaskit/templates/project/Dockerfile +56 -0
- flaskit/templates/project/app.py.j2 +551 -0
- flaskit/templates/project/assets/swagger-ui/swagger-ui-bundle.js +2 -0
- flaskit/templates/project/assets/swagger-ui/swagger-ui-standalone-preset.js +2 -0
- flaskit/templates/project/assets/swagger-ui/swagger-ui.css +3 -0
- flaskit/templates/project/config.py.j2 +127 -0
- flaskit/templates/project/dockerignore +21 -0
- flaskit/templates/project/env.example.j2 +61 -0
- flaskit/templates/project/python-version +1 -0
- flaskit/templates/project/requirements.txt.j2 +14 -0
- flaskit/templates/project/templates/swagger_ui.html +43 -0
- flaskit_cli-0.2.1.dist-info/METADATA +127 -0
- flaskit_cli-0.2.1.dist-info/RECORD +23 -0
- flaskit_cli-0.2.1.dist-info/WHEEL +5 -0
- flaskit_cli-0.2.1.dist-info/entry_points.txt +2 -0
- flaskit_cli-0.2.1.dist-info/licenses/LICENSE +674 -0
- flaskit_cli-0.2.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flaskit-cli
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: CLI scaffolding tool for Flask-Smorest projects with modular resources and Swagger definitions
|
|
5
|
+
Author: flaskit contributors
|
|
6
|
+
License-Expression: GPL-3.0-or-later
|
|
7
|
+
Project-URL: Homepage, https://github.com/mghorbani2357/flaskit
|
|
8
|
+
Project-URL: Documentation, https://flaskit.readthedocs.io/
|
|
9
|
+
Project-URL: Source, https://github.com/mghorbani2357/flaskit
|
|
10
|
+
Project-URL: Issues, https://github.com/mghorbani2357/flaskit/issues
|
|
11
|
+
Keywords: flask,smorest,cli,scaffold,openapi
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Framework :: Flask
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: click>=8.1
|
|
26
|
+
Requires-Dist: Jinja2>=3.1
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
29
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
30
|
+
Provides-Extra: docs
|
|
31
|
+
Requires-Dist: mkdocs>=1.5; extra == "docs"
|
|
32
|
+
Requires-Dist: mkdocs-material>=9.0; extra == "docs"
|
|
33
|
+
Requires-Dist: pymdown-extensions>=10.0; extra == "docs"
|
|
34
|
+
Provides-Extra: test
|
|
35
|
+
Requires-Dist: pytest>=7.0; extra == "test"
|
|
36
|
+
Requires-Dist: build>=1.0; extra == "test"
|
|
37
|
+
Requires-Dist: Flask>=3.0; extra == "test"
|
|
38
|
+
Requires-Dist: flask-smorest>=0.44; extra == "test"
|
|
39
|
+
Requires-Dist: marshmallow<5,>=3.24.1; extra == "test"
|
|
40
|
+
Requires-Dist: webargs>=8.3; extra == "test"
|
|
41
|
+
Requires-Dist: apispec>=6.3; extra == "test"
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
|
|
44
|
+
# flaskit
|
|
45
|
+
|
|
46
|
+
[](https://pypi.org/project/flaskit-cli/)
|
|
47
|
+
[](https://pypi.org/project/flaskit-cli/)
|
|
48
|
+
[](LICENSE)
|
|
49
|
+
[](https://flaskit.readthedocs.io/)
|
|
50
|
+
[](https://github.com/mghorbani2357/flaskit/actions)
|
|
51
|
+
|
|
52
|
+
CLI scaffolding for **Flask + Flask-Smorest** APIs: modular resources, auto-discovery, local Swagger UI, JSON logging (optional OpenTelemetry), `BASE_PATH` for every route and asset, and a production Docker image with **bjoern**.
|
|
53
|
+
|
|
54
|
+
**Documentation:** [flaskit.readthedocs.io](https://flaskit.readthedocs.io/) · source under [`docs/`](docs/)
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install -e ".[docs]"
|
|
58
|
+
mkdocs serve
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Install
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pip install flaskit-cli
|
|
65
|
+
# or from source
|
|
66
|
+
pip install -e .
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
PyPI name is **`flaskit-cli`** (`flaskit` / `flask-it` are taken or blocked); the CLI and import stay **`flaskit`**.
|
|
70
|
+
|
|
71
|
+
Requires Python **3.10+** for the CLI. Generated apps target **3.11–3.13** (3.12 recommended; see `.python-version`).
|
|
72
|
+
|
|
73
|
+
## Quick start
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
flaskit init myapi
|
|
77
|
+
cd myapi
|
|
78
|
+
python3.12 -m venv .venv
|
|
79
|
+
# Windows PowerShell (if scripts are blocked):
|
|
80
|
+
# Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
|
|
81
|
+
# .\.venv\Scripts\Activate.ps1
|
|
82
|
+
pip install -U pip && pip install -r requirements.txt
|
|
83
|
+
flaskit generate module users
|
|
84
|
+
python app.py
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Open [http://127.0.0.1:5000/docs](http://127.0.0.1:5000/docs).
|
|
88
|
+
|
|
89
|
+
## CLI
|
|
90
|
+
|
|
91
|
+
| Command | Description |
|
|
92
|
+
|---------|-------------|
|
|
93
|
+
| `flaskit init [path]` | Scaffold project (`app.py`, flat `config.py`, `resources/`, `assets/`, `templates/`) |
|
|
94
|
+
| `flaskit generate module <name>` | Create `resources/<name>/` with `flask_bp` + `smorest_blp` stubs |
|
|
95
|
+
|
|
96
|
+
## Layout
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
app.py # create_app, init_app
|
|
100
|
+
config.py # flat UPPER_CASE settings from env
|
|
101
|
+
templates/
|
|
102
|
+
swagger_ui.html # Swagger UI page (Jinja)
|
|
103
|
+
resources/
|
|
104
|
+
users/
|
|
105
|
+
blueprint.py # Flask blueprint (flask_bp) + URL_PREFIX
|
|
106
|
+
resource.py # Smorest blueprint (smorest_blp) + CRUD
|
|
107
|
+
schema.py # Request / Response schemas
|
|
108
|
+
assets/
|
|
109
|
+
swagger-ui/ # local Swagger UI (no CDN)
|
|
110
|
+
statics/ # public files at {BASE_PATH}/assets/statics/...
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Highlights
|
|
114
|
+
|
|
115
|
+
- **`BASE_PATH`** applies to API routes, `/docs`, and `/assets`
|
|
116
|
+
- **Timezone** via `TIMEZONE` (IANA); log fields include `timezone` / `tz_offset`
|
|
117
|
+
- **Logging** to stream and/or file; optional OTel with the same sinks when enabled
|
|
118
|
+
- **Docker** on Python **3.13**; **bjoern** installed in-image only
|
|
119
|
+
- **Versioning** of the flaskit package itself from **git tags** (`setuptools-scm`)
|
|
120
|
+
|
|
121
|
+
## Publish (maintainers)
|
|
122
|
+
|
|
123
|
+
Push a tag `v*` to trigger [`.github/workflows/publish.yml`](.github/workflows/publish.yml). Set repository secret **`PYPI_API_TOKEN`** only (Python/PyPI URL are fixed in the workflow).
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
GPL-3.0-or-later. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
flaskit/__init__.py,sha256=fGJsNjnajvWiR-glLByQqmjd77VlClF0Pvqe1tA5iT8,446
|
|
2
|
+
flaskit/__main__.py,sha256=CwNvtYldCt9NXfAepK72t1D6WLE5RWXQOzia6H4d3V0,106
|
|
3
|
+
flaskit/cli.py,sha256=SR4afYdzk1TuBxj6lCj208jgk0h4KJv7K5E-Ghv2lyE,9585
|
|
4
|
+
flaskit/templates/module/blueprint.py.j2,sha256=sUInmEwrp3Gib2nsvXd3D6N-scxn0QullgdG1NE_f0c,310
|
|
5
|
+
flaskit/templates/module/resource.py.j2,sha256=3S_MGt-Z_4VE9aoeFkChcNPpQTZwdQBZ3py7BufbFHA,1426
|
|
6
|
+
flaskit/templates/module/schema.py.j2,sha256=GvDkYdGNt0XmsyYBqX83kKnjafuUQVZuBfUQic0mtrA,136
|
|
7
|
+
flaskit/templates/project/Dockerfile,sha256=SF1i8DPhl1pkNbpbuHc4HRmgstsgm_Y-L4mKFIGqIbw,1373
|
|
8
|
+
flaskit/templates/project/app.py.j2,sha256=IP81t57nyPJ61S-TaY-XAeTywXxDTvI6L2nfA3LyiGo,18408
|
|
9
|
+
flaskit/templates/project/config.py.j2,sha256=6Trv74kvIyMwY_2sUBd-EgXEEC917fZPUU3-jvwhMno,4865
|
|
10
|
+
flaskit/templates/project/dockerignore,sha256=MeEhPXJNzuIOY0P5to8nYiDbb1FJUElBIHIvrt72guo,210
|
|
11
|
+
flaskit/templates/project/env.example.j2,sha256=WlcB1XZpkwBAXLOjFPQyieibVuFZO1AIBBXsuI1yuZE,1552
|
|
12
|
+
flaskit/templates/project/python-version,sha256=e1X45ntWI8S-8_ppEojalDfXnTq6FW3kjUgdsyrH0W0,5
|
|
13
|
+
flaskit/templates/project/requirements.txt.j2,sha256=JwTEkiR6xt2BR2vsiZhaWyYkP3nE89bs5rYE3vxkcQ4,492
|
|
14
|
+
flaskit/templates/project/assets/swagger-ui/swagger-ui-bundle.js,sha256=wuSp7wgUSDn_R8FCAgY-z-TlnnCk5xVKJr1Q2IDIi6E,1452753
|
|
15
|
+
flaskit/templates/project/assets/swagger-ui/swagger-ui-standalone-preset.js,sha256=M7em9a_KxJAv35MoG-LS4S2xXyQdOEYG5ubRd0W3-G8,230293
|
|
16
|
+
flaskit/templates/project/assets/swagger-ui/swagger-ui.css,sha256=QBcPDuhZ0X-SExunBzKaiKBw5PZodNETZemnfSMvYRc,152071
|
|
17
|
+
flaskit/templates/project/templates/swagger_ui.html,sha256=nBopc8Iz_QFHnUumPmQjBnxqBBsC6xHG-s4vIougi7g,1242
|
|
18
|
+
flaskit_cli-0.2.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
19
|
+
flaskit_cli-0.2.1.dist-info/METADATA,sha256=7OBQ9kUtD1_r8rRmaZ1Dy9bRR7LSPzSa-RkedtzlB4c,4888
|
|
20
|
+
flaskit_cli-0.2.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
21
|
+
flaskit_cli-0.2.1.dist-info/entry_points.txt,sha256=g9uoFvAoH1x9-Gdgkm6utR_3nozvmMLm37olMbb-tOo,45
|
|
22
|
+
flaskit_cli-0.2.1.dist-info/top_level.txt,sha256=H6IvQNjWcJwSZ7UyEsQcTRlxbTDGirw5kLo9Ou7Y7vo,8
|
|
23
|
+
flaskit_cli-0.2.1.dist-info/RECORD,,
|