Skip to main content

Flask-RESTAlchemy

build codecov black black

A Flask extension to build REST APIs. It dismiss the need of building Schema classes, since usually all the information needed to serialize an SQLAlchemy instance is in the model itself.

By adding a model to the API, all its properties will be exposed:

class User(Base):

    __tablename__ = "User"

    id = Column(Integer, primary_key=True)
    firstname = Column(String)
    lastname = Column(String)
    email = Column(String)
    password = Column(String)


api = Api(flask_app)
api.add_model(User, "/user")

To change the way properties are serialized, declare only the one that needs a non-default behaviour:

from serialchemy import ModelSerializer, Field


class UserSerializer(ModelSerializer):

    password = Field(load_only=True)


api = Api(flask_app)
api.add_model(User, "/user", serializer_class=UserSerializer)

Development Setup

Requires uv.

uv python pin 3.10
uv sync --group dev
source .venv/bin/activate

If serialchemy is checked out as a sibling repository, install it as an editable dependency:

uv pip install -e ../serialchemy

Run the tests:

pytest src/flask_restalchemy/tests/

Release

A reminder for the maintainers on how to make a new release.

Note that the VERSION should folow the semantic versioning as X.Y.Z Ex.: v1.0.5

  1. Create a release-VERSION branch from upstream/master.
  2. Update CHANGELOG.rst.
  3. Push a branch with the changes.
  4. Once all builds pass, push a VERSION tag to upstream.
  5. Merge the PR.

Metadata

Release files for flask-restalchemy 0.15.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flask-restalchemy 0.15.1
File Size Uploaded Provenance
flask_restalchemy-0.15.1.tar.gz 95.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for flask-restalchemy 0.15.1
File Interpreter ABI Platform
flask_restalchemy-0.15.1-py3-none-any.whl Python 3 none any Details

Total release size: 125.5 kB

Release files / flask_restalchemy-0.15.1.tar.gz

Download URL flask_restalchemy-0.15.1.tar.gz
Size 95.4 kB
Tags Source
SHA-256 checksum
How to use checksums
83028a1f551850b02a338ff7426bfb3f218a44a6f1f01bc44aad12de72713ac2
BLAKE2b-256 checksum
How to use checksums
0e619c0f1f219a6473793f5924c9719fe511c080d04fa3cb8e7f1f2f818adfec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / flask_restalchemy-0.15.1-py3-none-any.whl

Download URL flask_restalchemy-0.15.1-py3-none-any.whl
Size 30.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6729a2e5900595826a7f27df4ebddbec7fa09a42c05131879293af465db55fb7
BLAKE2b-256 checksum
How to use checksums
18a36f0f7695077fb06d0ccbfd6f2da8774fc604767a5344530bc69181d33e3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Security for flask-restalchemy 0.15.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page