Coder Social home page Coder Social logo

megasanjay / api.fairhub.io Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ai-readi/fairhub-api

0.0 1.0 0.0 1.59 MB

API for fairhub.io

License: MIT License

Shell 0.01% Python 92.60% Dockerfile 0.05% Mako 0.06% Jupyter Notebook 0.51% PLpgSQL 6.79%

api.fairhub.io's Introduction

fairhub-api

Getting started

Prerequisites/Dependencies

You will need the following installed on your system:

Setup

If you would like to update the api, please follow the instructions below.

Don't forget to start the database before running the api. See Database for more information.

  1. Create a local virtual environment and activate it:

    python -m venv .venv
    source .venv/bin/activate

    If you are using Anaconda, you can create a virtual environment with:

    conda create -n fairhub-api-dev-env python=3.10
    conda activate fairhub-api-dev-env
  2. Install the dependencies for this package. We use Poetry to manage the dependencies:

    pip install poetry==1.3.2
    poetry install

    You can also use version 1.2.0 of Poetry, but you will need to run poetry lock after installing the dependencies.

  3. Add your environment variables. An example is provided at .env.example

    cp .env.example .env

    Make sure to update the values in .env to match your local setup.

  4. Add your modifications and run the tests:

    poetry run pytest

    If you need to add new python packages, you can use Poetry to add them:

     poetry add <package-name>
  5. Format the code:

    poe format
  6. Check the code quality:

    poe typecheck
    poe lint
    poe flake8

    You can also use poe precommit to run both formatting and linting.

  7. Run the tests and check the code coverage:

    poe test
    poe test_with_capture # if you want to see console output

Database

The api uses a postgres and redis database. You can create both of these locally via docker:

docker-compose -f ./dev-docker-compose.yaml up
docker-compose -f ./dev-docker-compose.yaml up -d # if you want the db to run in the background

Close the database with:

docker-compose -f ./dev-docker-compose.yaml down -v

Running

For developer mode:

poe dev

or

flask run --debug

For production mode:

python3 app.py --host $HOST --port $PORT

License

This work is licensed under MIT. See LICENSE for more information.

AI-READI logo

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.