Coder Social home page Coder Social logo

florentx / flask-restless Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jfinkels/flask-restless

1.0 3.0 0.0 1.24 MB

A Flask extension for creating simple ReSTful APIs from Flask-SQLAlchemy models.

Home Page: http://packages.python.org/Flask-Restless

License: GNU Affero General Public License v3.0

Python 100.00%

flask-restless's Introduction

Flask-Restless

Introduction

This is Flask-Restless, a Flask extension which facilitates the creation of ReSTful JSON APIs. It is compatible with models which 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, check the World Wide Web!

Build status

Copyright license

The code comprising this program is copyright 2011 Lincoln de Sousa and copyright 2012 Jeffrey Finkelstein, and is dual-licensed under the following two copyright licenses:

  • the GNU Affero General Public License, either version 3 or (at your option) any later version
  • the 3-clause BSD License

For more information, see the files LICENSE.AGPL and LICENSE.BSD in this directory.

Contents

This is a partial listing of the contents of this package.

  • COPYING - the copyright license under which this program is distributed to you (the GNU Affero General Public License version 3)
  • docs/ - the Sphinx documentation for Flask-Restless
  • examples/ - example applications of Flask-Restless
  • flask_restless/ - the Python package containing the extension
  • README.md - this file
  • setup.py - Python setuptools configuration file for packaging this extension
  • tests/ - unit tests for Flask-Restless

The flask_restless directory is a Python package containing the following files:

  • views.py - the view class which implements the ReSTful API
  • manager.py - the main class which end users will utilize to create ReSTful APIs for their database models
  • search.py - functions and classes which facilitate searching the database on requests which require a search

Installing

This application requires Python version 2.5, 2.6, or 2.7.

This application requires the following libraries to be installed:

These requirements are also listed in the requirements.txt file. Using pip is probably the easiest way to install these:

pip install -r requirements.txt

or

pip install Flask Flask-SQLAlchemy python-dateutil simplejson sqlalchemy

Technical note: simplejson is only required if you are using Python 2.5. The built-in json module will suffice in later Python versions.

Building as a Python egg

This package can be built, installed, etc. as a Python egg using the provided setup.py script. For more information, run

python setup.py --help

How to use

For information on how to use this extension, build the documentation here or view it on the Web.

Testing

Running the unit tests requires the unittest2 package, which backports the functionality of the built-in unittest package from Python version 2.7 to earlier versions. This requirement is also listed in the requirements-test.txt file.

Using pip is probably the easiest way to install this:

pip install -r requirements-test.txt

or

pip install unittest2

The Python unit tests are contained in the tests/ directory (which is a Python package). To run the test suite, run the command

python setup.py test

You can also run the unit tests in a less verbose way by doing

./run-tests.py

This is a Python module which, when executed, simply runs all unit tests.

Test coverage

You can measure the test coverage by running

python setup.py coverage

Measuring test coverage requires the coverage.py package, which can be installed like this:

pip install coverage

Testing validation

Validation is not provided directly by Flask-Restless, but it does provide a way for users to indicate exceptions to catch. If you wish to test validation of SQLAlchemy models with a real external SQLAlchemy validation library, install the development version of SAValidation:

pip install -e "hg+http://bitbucket.org/rsyring/sqlalchemy-validation#egg=savlidation-dev"

The test suite will automatically skip these tests if it is not installed.

Building documentation

Flask-Restless requires the following program and supporting library to build the documentation:

These requirements are also listed in the requirements-doc.txt file. Using pip is probably the easiest way to install these:

pip install -r requirements-doc.txt

or

pip install sphinx "sphinxcontrib-httpdomain>=1.1.7"

The documentation is written for Sphinx in reStructuredText files in the docs/ directory. Documentation for each class and function is provided in the docstring in the code.

The documentation uses the Flask Sphinx theme. It is included as a git submodule of this project, rooted at docs/_themes. To get the themes, do

git submodule update --init

Now to build the documentation, run the command

python setup.py build_sphinx

in the top-level directory. The output can be viewed in a web browser by opening docs/_build/html/index.html.

Authors

See the AUTHORS file for a list of people who have contributed to this code.

Artwork

The artwork/flask-restless-small.svg and docs/_static/flask-restless-small.png are licensed under the Creative Commons Attribute-ShareAlike 3.0 license. The original image is a scan of a (now public domain) illustration by Arthur Hopkins in a serial edition of "The Return of the Native" by Thomas Hardy published in October 1878.

The artwork/flask-restless.svg and docs/_static/flask-restless.png are licensed under the Flask Artwork License.

Contact

Jeffrey Finkelstein [email protected]

flask-restless's People

Contributors

alekzvik avatar clarete avatar davidthewatson avatar jfinkels avatar tageorgiou avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.