Metadata-Version: 2.4
Name: flaskit-cli
Version: 0.2.1
Summary: CLI scaffolding tool for Flask-Smorest projects with modular resources and Swagger definitions
Author: flaskit contributors
License-Expression: GPL-3.0-or-later
Project-URL: Homepage, https://github.com/mghorbani2357/flaskit
Project-URL: Documentation, https://flaskit.readthedocs.io/
Project-URL: Source, https://github.com/mghorbani2357/flaskit
Project-URL: Issues, https://github.com/mghorbani2357/flaskit/issues
Keywords: flask,smorest,cli,scaffold,openapi
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Framework :: Flask
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Code Generators
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.1
Requires-Dist: Jinja2>=3.1
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: build>=1.0; extra == "dev"
Provides-Extra: docs
Requires-Dist: mkdocs>=1.5; extra == "docs"
Requires-Dist: mkdocs-material>=9.0; extra == "docs"
Requires-Dist: pymdown-extensions>=10.0; extra == "docs"
Provides-Extra: test
Requires-Dist: pytest>=7.0; extra == "test"
Requires-Dist: build>=1.0; extra == "test"
Requires-Dist: Flask>=3.0; extra == "test"
Requires-Dist: flask-smorest>=0.44; extra == "test"
Requires-Dist: marshmallow<5,>=3.24.1; extra == "test"
Requires-Dist: webargs>=8.3; extra == "test"
Requires-Dist: apispec>=6.3; extra == "test"
Dynamic: license-file

# flaskit

[![PyPI version](https://img.shields.io/pypi/v/flaskit-cli.svg)](https://pypi.org/project/flaskit-cli/)
[![Python versions](https://img.shields.io/pypi/pyversions/flaskit-cli.svg)](https://pypi.org/project/flaskit-cli/)
[![License: GPL-3.0](https://img.shields.io/badge/License-GPLv3-blue.svg)](LICENSE)
[![Docs](https://img.shields.io/badge/docs-Read%20the%20Docs-blue)](https://flaskit.readthedocs.io/)
[![CI publish](https://img.shields.io/badge/publish-on%20git%20tag-success)](https://github.com/mghorbani2357/flaskit/actions)

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**.

**Documentation:** [flaskit.readthedocs.io](https://flaskit.readthedocs.io/) · source under [`docs/`](docs/)

```bash
pip install -e ".[docs]"
mkdocs serve
```

## Install

```bash
pip install flaskit-cli
# or from source
pip install -e .
```

PyPI name is **`flaskit-cli`** (`flaskit` / `flask-it` are taken or blocked); the CLI and import stay **`flaskit`**.

Requires Python **3.10+** for the CLI. Generated apps target **3.11–3.13** (3.12 recommended; see `.python-version`).

## Quick start

```bash
flaskit init myapi
cd myapi
python3.12 -m venv .venv
# Windows PowerShell (if scripts are blocked):
#   Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
#   .\.venv\Scripts\Activate.ps1
pip install -U pip && pip install -r requirements.txt
flaskit generate module users
python app.py
```

Open [http://127.0.0.1:5000/docs](http://127.0.0.1:5000/docs).

## CLI

| Command | Description |
|---------|-------------|
| `flaskit init [path]` | Scaffold project (`app.py`, flat `config.py`, `resources/`, `assets/`, `templates/`) |
| `flaskit generate module <name>` | Create `resources/<name>/` with `flask_bp` + `smorest_blp` stubs |

## Layout

```
app.py                 # create_app, init_app
config.py              # flat UPPER_CASE settings from env
templates/
  swagger_ui.html      # Swagger UI page (Jinja)
resources/
  users/
    blueprint.py       # Flask blueprint (flask_bp) + URL_PREFIX
    resource.py        # Smorest blueprint (smorest_blp) + CRUD
    schema.py          # Request / Response schemas
assets/
  swagger-ui/          # local Swagger UI (no CDN)
  statics/             # public files at {BASE_PATH}/assets/statics/...
```

## Highlights

- **`BASE_PATH`** applies to API routes, `/docs`, and `/assets`
- **Timezone** via `TIMEZONE` (IANA); log fields include `timezone` / `tz_offset`
- **Logging** to stream and/or file; optional OTel with the same sinks when enabled
- **Docker** on Python **3.13**; **bjoern** installed in-image only
- **Versioning** of the flaskit package itself from **git tags** (`setuptools-scm`)

## Publish (maintainers)

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).

## License

GPL-3.0-or-later. See [LICENSE](LICENSE).
