The initial idea is to be a Rest API factory, with the aim of making it easy to create from models defined using the SQLAlchemy ORM.
We still use pydantic to serialize objects and payloads.
Install
You can install using pip:
$ pip install flask-api-factory
You can install with the database driver you want to be supported by SQLAlchemy, but if you prefer, you can install the driver as an extra library, with the command:
$ pip install flask-api-factory[postgres]
This will install psycopg2 together with our library.
You can still install using poetry with the command:
$ poetry add flask-api-factory
A simple example
Having the Pet model already defined and the initialization of the Flask application already started, just use the following code:
from flask import Flask, Blueprint
from flask_api_factory import factory_api
from .models import Pet
from .serializers import PetSerializer
blueprint = Blueprint("pets", __name__, url_prefix="/pets")
def init_app(app: Flask) -> None:
app.register_blueprint(blueprint)
factory_api(blueprint, Pet, PetSerializer)
This way we will have a /pets endpoint capable of responding to all HTTP verbs. Consulting the documentation you can check other options for configurations and functionalities.
Roadmap
- Documentation;
-
openapi.jsongeneration mechanism; - A way to provide
Swaggerand/orRedoc; - Write unit tests.
Metadata
Release files for flask-api-factory 0.2.3
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_api_factory-0.2.3.tar.gz | 8.4 kB | Without provenance | Details for flask_api_factory-0.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flask_api_factory-0.2.3-py3-none-any.whl | Python 3 | none | any | Details for flask_api_factory-0.2.3-py3-none-any.whl |
Total release size: 19.7 kB
Release files / flask_api_factory-0.2.3.tar.gz
| Download URL | flask_api_factory-0.2.3.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d94017a5e388c1f9220951b5991ec2a5c1c8894566afda0484401f338df07285
|
|
BLAKE2b-256 checksum How to use checksums |
b0a85dd9cb8d2559960d7899ffafbd05ff166a84bafe42b776458b5181094f21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.0 CPython/3.10.10 Linux/5.15.0-1033-azure
|
Release files / flask_api_factory-0.2.3-py3-none-any.whl
| Download URL | flask_api_factory-0.2.3-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0f6a1e811fd07ed1625264f6b9923b63d4798118fa8c970eee2691f83c84c8de
|
|
BLAKE2b-256 checksum How to use checksums |
8eced2c7af2155c4dc303bd2731a437263b9921aff8953641b74b4d428efd692
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.0 CPython/3.10.10 Linux/5.15.0-1033-azure
|
Security for flask-api-factory 0.2.3
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.