Skip to content

isnandar1471/semaphore-api

Repository files navigation

Semaphore API

Work Notes

  • ...

Environment

  • Python 3.10.11
  • MariaDB 10.4

Clone the Project

To clone this project, run the following command:

git clone https://github.com/isnandar1471/semaphore-api.git

Install Dependencies

To install all necessary dependencies, run:

pip install -r requirements.txt

Important dependencies:

  • tensorflow: For reading imported models.
  • bcrypt: For password encryption.
  • sqlalchemy: For ORM.
  • sqlalchemy-seeder: For seeding.
  • alembic: For database version control.
  • fastapi: For REST API.
  • starlette: For ASGI framework.
  • uvicorn: For ASGI server.
  • python-dotenv: For reading env files.
  • pymysql: For MySQL connection.
  • pydantic: For data validation.
  • pyjwt: For generating JWT.
  • pillow: For image processing.
  • numpy: For image conversion.

Error Documentation

  • sqlalchemy requires pymysql, but it is not automatically installed.
  • Some dependencies require pillow.

Copy .env.example to .env, and change the value to what you need

cp .env.example .env

Token

Using JWT for authentication.

Database

Migrations

To create a new migration:

alembic revision -m "<migration_description>"

To run migrations up to a specific version:

alembic upgrade <version>

To run migrations to the latest version:

alembic upgrade head

To rollback x number of migrations:

alembic downgrade <-x>

Seeding

To seed the database, run the following command:

python -m src.seeder.seeder

Running the Application

To run the application, use:

python main.py

Running the Application with Docker

This application can also be run in Docker using the provided scripts in the docker folder.

Additional Resources

Installing All Packages from requirements.txt

A guide for installing all available packages from requirements.txt can be found here.

Using AutoFlake to Remove Unused Imports

autoflake --in-place --remove-all-unused-imports <filepath>

Using isort to Sort Import Statements

isort <filepath>

Linter Using pylint

To maintain code quality, use pylint as a linter.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages