A fork of Flask-Restless with updated dependencies and bug fixes
Project description
Flask-Restless-NG
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flask_restless_ng-3.3.0.tar.gz.
File metadata
- Download URL: flask_restless_ng-3.3.0.tar.gz
- Upload date:
- Size: 95.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a3d911a90af39d81e32dc8b3078c2ed40722c3891d44e3346b40a849e8018c1
|
|
| MD5 |
41ec0f54830dd0a3e58aef340f023ccb
|
|
| BLAKE2b-256 |
5d68ff1282b7183fed44e3bdeafa18117dac8154c91369f17a431bc134112fce
|
File details
Details for the file flask_restless_ng-3.3.0-py3-none-any.whl.
File metadata
- Download URL: flask_restless_ng-3.3.0-py3-none-any.whl
- Upload date:
- Size: 73.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e0c6de924a451bc06ff5f2e7cece3ad90bfa5cdfa9a72ba4c67dfdd8cb1de53
|
|
| MD5 |
2b22e3e52b12ff60f2eb299d07f915eb
|
|
| BLAKE2b-256 |
d9e4a2673945abeb46a12e43f2b5983b2475e324addac9d63f0011736cb3cd66
|
File details
Details for the file flask_restless_ng-3.3.0-py2.py3-none-any.whl.
File metadata
- Download URL: flask_restless_ng-3.3.0-py2.py3-none-any.whl
- Upload date:
- Size: 74.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fd65ede6431d3980ae2743252554dc5d01d2a23606d57d07e55917e892bdb17
|
|
| MD5 |
6d75d85c46b43c3f2bcf8970adb45ab1
|
|
| BLAKE2b-256 |
79b681bc1c868c4f04df6cb5231b94d76611136872eebbaa49daec821cc3c6ba
|