Skip to main content

Flask-Restless-NG

PyPI version Build Status Coverage Status Documentation Status

About

This is a Flask extension that creates URL endpoints that satisfy the requirements of the JSON API specification. It is compatible with models that have been defined using either SQLAlchemy or Flask-SQLAlchemy.

This is a fork of Flask-Restless module originally written by Jeffrey Finkelstein.

Version 1.0.* of Flask-Restless-NG is fully API compatible with Flask-Restless version 1.0.0b1 with the following improvements:

  • Supports Flask 2.2+ and SQLAlchemy 1.4.x-2.0.x
  • 2-5x faster serialization of JSON responses.
  • Miscellaneous bugs fixed

Version 2.0.* adds a few backward incompatible changes with more performance improvements

Introduction

This is Flask-Restless, a Flask extension that creates URL endpoints that satisfy the requirements of the JSON API specification. It is compatible with models that have been defined using either SQLAlchemy or Flask-SQLAlchemy.

This document contains some brief instructions concerning installation of requirements, installation of this extension, configuration and usage of this extension, and building of documentation.

For more information, see the

Installing

This application can be used with any Python version 3.8+

pip install Flask-Restless-NG

Development Setup

For development, it's recommended to use a virtual environment:

# Clone the repository
git clone https://github.com/mrevutskyi/flask-restless-ng.git
cd flask-restless-ng

# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in editable mode with dev dependencies
pip install -e ".[dev,test,doc]"

# Run tests
pytest tests/

# Run code quality checks
make check

See CONTRIBUTING.md for detailed development instructions.

Example

import flask
import flask_restless
import flask_sqlalchemy

# Create the Flask application and the Flask-SQLAlchemy object.
app = flask.Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test.db'
db = flask_sqlalchemy.SQLAlchemy(app)


class Person(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.Unicode)
    birth_date = db.Column(db.Date)


class Article(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.Unicode)
    published_at = db.Column(db.DateTime)
    author_id = db.Column(db.Integer, db.ForeignKey('person.id'))
    author = db.relationship(Person, backref=db.backref('articles'))


# Create the database tables.
db.create_all()

# Create the Flask-Restless API manager.
manager = flask_restless.APIManager(app, session=db.session)

# Create API endpoints, which will be available at /api/<table_name> by
# default. Allowed HTTP methods can be specified as well.
manager.create_api(Person, methods=['GET', 'POST', 'DELETE'])
manager.create_api(Article, methods=['GET'])

# start the flask loop
app.run()

More information on how to use this extension is available in the documentation.

Feedback

Please fill out the feedback form, this would help me determine if this package is still valuable

Contact

Maksym Revutskyi maksym.revutskyi@gmail.com

Release files for Flask-Restless-NG 3.3.0

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-Restless-NG 3.3.0
File Size Uploaded
flask_restless_ng-3.3.0.tar.gz 95.6 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for Flask-Restless-NG 3.3.0
File Interpreter ABI Platform
flask_restless_ng-3.3.0-py3-none-any.whl Python 3 none any Details
flask_restless_ng-3.3.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 243.0 kB

Release files / flask_restless_ng-3.3.0.tar.gz

Download URL flask_restless_ng-3.3.0.tar.gz
Size 95.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0a3d911a90af39d81e32dc8b3078c2ed40722c3891d44e3346b40a849e8018c1
BLAKE2b-256 checksum
How to use checksums
5d68ff1282b7183fed44e3bdeafa18117dac8154c91369f17a431bc134112fce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / flask_restless_ng-3.3.0-py3-none-any.whl

Download URL flask_restless_ng-3.3.0-py3-none-any.whl
Size 73.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e0c6de924a451bc06ff5f2e7cece3ad90bfa5cdfa9a72ba4c67dfdd8cb1de53
BLAKE2b-256 checksum
How to use checksums
d9e4a2673945abeb46a12e43f2b5983b2475e324addac9d63f0011736cb3cd66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / flask_restless_ng-3.3.0-py2.py3-none-any.whl

Download URL flask_restless_ng-3.3.0-py2.py3-none-any.whl
Size 74.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
8fd65ede6431d3980ae2743252554dc5d01d2a23606d57d07e55917e892bdb17
BLAKE2b-256 checksum
How to use checksums
79b681bc1c868c4f04df6cb5231b94d76611136872eebbaa49daec821cc3c6ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

3.3.0 This release

3 release files

3.2.3

2 release files

3.2.1

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.0

2 release files

2.5.1

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.9

2 release files

2.2.8

2 release files

2.2.7

2 release files

2.2.6

2 release files

2.2.5

2 release files

2.2.4

2 release files

2.2.3

2 release files

2.2.2

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.0.2

2 release files

0.0.1

2 release files

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