Flask-RESTX-marshmallow
Flask-RESTX-marshmallow is a powerful extension that seamlessly combines Flask, Flask-RESTX, and Marshmallow to provide a robust foundation for building RESTful APIs with automatic documentation and data validation.
✨ Features
- 🚀 Seamless Integration: Combines Flask-RESTX's API documentation with Marshmallow's powerful serialization
- 📋 Automatic Documentation: Generate interactive Swagger/OpenAPI documentation automatically
- 🔍 Data Validation: Built-in request/response validation using Marshmallow schemas
- 🎯 Type Safety: Full type hint support for better development experience
- 🔧 Easy Configuration: Minimal setup required to get started
- 📦 SQLAlchemy Integration: Works perfectly with Flask-SQLAlchemy
🔧 Requirements
- Python 3.12+
- Flask 3.1+
- Flask-RESTX 1.3+
- Marshmallow 4.0+
📦 Installation
Install the extension with pip:
pip install flask-restx-marshmallow
or with poetry:
poetry add flask-restx-marshmallow
or with uv
uv add flask-restx-marshmallow
🚀 Quick Start
Complete Example
For a comprehensive example with SQLAlchemy integration, see app.py. This example demonstrates:
- RESTful API endpoints with full CRUD operations
- Automatic request/response validation
- Interactive Swagger documentation
- Database integration with Flask-SQLAlchemy
- Error handling and status codes
The example application provides these endpoints:
| Endpoint | Method | Description |
|---|---|---|
/tasks/ |
GET | Query all tasks with optional filtering |
/tasks/ |
POST | Create a new task |
/tasks/<id> |
GET | Retrieve a specific task by ID |
/tasks/<id> |
PATCH | Update a task partially |
/tasks/<id> |
DELETE | Delete a task by ID |
🏃♂️ Running the Example
-
Clone the repository:
git clone https://github.com/1746104160/flask-restx-marshmallow.git && cd flask-restx-marshmallow -
Install dependencies:
poetry install --with devor
uv sync --dev -
Run the example application:
python app.pyor
flask run -
Visit
http://localhost:5000to explore the interactive API documentation.
📚 Documentation
Visit the interactive API documentation when running your application to explore all available endpoints and schemas. The documentation is automatically generated from your code and provides:
- Interactive API testing: Try out endpoints directly from the browser
- Schema visualization: See request/response models with examples
- Parameter documentation: Understand required and optional parameters
- Error responses: Learn about possible error scenarios
🧪 Testing
Run the test suite:
pytest
📄 License
This project is licensed under the MIT License.
🔗 Links
- GitHub Repository
- PyPI Package
- Flask Documentation
- Flask-RESTX Documentation
- Marshmallow Documentation
⭐ Star History
If you find this project useful, please consider giving it a star on GitHub!
Metadata
Release files for flask_restx_marshmallow 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flask_restx_marshmallow-0.2.0.tar.gz | 502.9 kB | Without provenance | Details for flask_restx_marshmallow-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flask_restx_marshmallow-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for flask_restx_marshmallow-0.2.0-py3-none-any.whl |
Total release size: 1.0 MB
Release files / flask_restx_marshmallow-0.2.0.tar.gz
| Download URL | flask_restx_marshmallow-0.2.0.tar.gz |
|---|---|
| Size | 502.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c3510509ccbb98bf8ce936decd5627c12a581fb6b1800c77015ad6751499716d
|
|
BLAKE2b-256 checksum How to use checksums |
3ed2484eba1885e7830cffaca6ff76a817f06ef63dae0cb87067a46adff7e15f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.3 Linux/6.6.87.2-microsoft-standard-WSL2
|
Release files / flask_restx_marshmallow-0.2.0-py3-none-any.whl
| Download URL | flask_restx_marshmallow-0.2.0-py3-none-any.whl |
|---|---|
| Size | 507.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0a9760f8ca3e49ec1355fb829403e539bb46db7c747bdd87986c8849edf7cc6d
|
|
BLAKE2b-256 checksum How to use checksums |
5339d9a946a64e6cf226358f2e4ca4fe3973261667e80df50eba411a3c42130d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.2 CPython/3.12.3 Linux/6.6.87.2-microsoft-standard-WSL2
|
Security for flask_restx_marshmallow 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.