Giter Club home page Giter Club logo

bonsai_web_api's Introduction

Bonsai Web API

What is it?

This is a basic Flask app on which to build the different web-based modules for Bonsai.

We foresee four inter-related applications:

  • a web application that handles interactions with users (requests for graphs, sessions, login, etc.)
  • a REST API that serves both the web application and direct REST requests on one side, and queries the graph DB on the other side,
  • a module that receive the whole graph database at server start, converts it into a two dimensional matrix and cache it for ulterior requests,
  • and a module that calculates LCA results upon requests from the REST API.

We do not yet have a working DB to receive triplestore queries from. However, we can use a dummy one in the meanwhile.

alt text

Install

Clone the repository

git clone https://github.com/BONSAMURAIS/bonsai_web_api

Create a virtual environment and activate it

python3 -m venv venv
. venv/bin/activate

Or on Windows cmd

py -3 -m venv venv
venv\Scripts\activate.bat

Install bonsai_web_api

pip install -e .

Or if you are using the master branch, install Flask from source before installing bonsai_web_api

pip install -e ../..
pip install -e .

Run

Docker

The application can be run as a doker container. Build the image first with:

docker build -t bonsai_web_api .

and then run it with:

docker run --rm -it --name bonsai_web_api -p 5000:5000 bonsai_web_api:latest

Native

Set the environment variables

export FLASK_APP=bonsai_web_api
export FLASK_ENV=development

Initalize the databases if first use

flask init-db

Run local server

flask run

Or on Windows cmd

set FLASK_APP=bonsai_web_api
set FLASK_ENV=development
flask init-db
flask run

Open http://127.0.0.1:5000 in a browser.

Test

pip install '.[test]'
pytest -v

Run with coverage report

coverage run -m pytest
coverage report
coverage html  # open htmlcov/index.html in a browser

bonsai_web_api's People

Contributors

dependabot[bot] avatar romainsacchi avatar tngtudor 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.