Skip to content
/ sap Public

Library of re-usable utilities for python web apps

Notifications You must be signed in to change notification settings

trellixio/sap

Repository files navigation

Python 3.12

SAP

Library of re-usable utilities for python web apps .

🔨 Installing

Python 3.12

Before getting started, ensure that Python 3.12 is installed on your computer.

MongoDB

MongoDB is a document-oriented database that use JSON-like documents to store data. You will need to install MongoDB 6.0 locally or sign up for a free hosted one with MongoDB Atlas. Once you install MongoDB, make sure to create a database.

Steps

Clone the repo and open a terminal at the root of the cloned repo.

  1. Setup a virtual env. Only do this on your first run.
python3.12 -m venv .venv
  1. Activate the virtualenv
source .venv/bin/activate
  1. Install all dependencies:
pip install -r requirements-dev.txt
  1. Set up pre-commit
pre-commit install

Allow pre-commit custom hooks execution

git update-index --chmod=+x scripts/*
  1. Init environment variables. Duplicate the env template file:
cp ./.env.tpl ./.env

Open .env file with a text editor and update the env vars as needed. Note that some env vars need to be update manually, so make sure to follow the instructions in the .env file.

🖌 Formatting

Keep in mind that those are automated formatting assistant tools. They will not always give the best result, as they just apply rules blindly. As a developer you still have the responsibility to ensure that the code is formatted with perfection.

  • Use black to format the code From the project root run:
black .
  • Use isort to sort the import From the project root run:
isort .

🧽 Linting

Linters are useful to ensure that your code quality matches with standards.

  • Running pre-commit on the project to run all linters.
pre-commit run --all-files
  • Use pylint to check for common mistakes. From the project root, run:
pylint AppMain sap tests
  • Use mypy to check for typing issues. From the project root, run:
mypy .
  • Use mypy to check for documentation issues. From the project root, run:
pydocstyle .

🧪 Testing

Tests are run using the pytest library.. From the project root, run:

pytest

Todo