💉
🔍
VaxFinder - Backend
Development
Prerequisites
- Python 3.8
- Poetry: A tool for dependency management and packaging.
- Access to VaxFinder's Microsoft SQL Server database hosted on Azure. Please message Patrick or Evan for access.
Installation
-
Install the unixODBC library if you are on a linux environment as it's required for pyodbc (hence aioodbc). You can install it using your package manager, for example:
$ sudo apt-get install unixodbc $ sudo apt-get install unixodbc-dev
-
Install Microsoft ODBC Driver 17 for SQL Server: Windows | Mac | Linux
-
Set up a VSCode MyPy Language Server (Optional)
On macOS or Linux:
$ python -m venv ~/.mypyls $ ~/.mypyls/bin/pip install "https://github.com/matangover/mypyls/archive/master.zip#egg=mypyls[default-mypy]"
On Windows:
$ python -m venv %USERPROFILE%\.mypyls $ %USERPROFILE%\.mypyls\Scripts\pip install "https://github.com/matangover/mypyls/archive/master.zip#egg=mypyls[default-mypy]"
Install the mypy extension in VS Code (or reload the window if the extension is already installed).
-
Install all python dependencies with Poetry.
$ poetry install
Running the Server
-
Spawn a shell within a virtual environment.
$ poetry shell
All python dependencies should be installed within the virtual environment from the previous step.
-
Run the server on port
8007
from the root of the project within the shell.$ DB_URL={DATABASE_URL} python -m app.main
- Swagger: http://localhost:8007/swagger
- ReDoc: http://localhost:8007/redoc
- OpenAPI Spec (JSON): http://localhost:8007/openapi.json
Pre-commit Hooks
Pre-commit hooks helps identify simple issues in code before it's committed into Git. At the moment, isort and black are the only hooks that are set up.
Install the git hook scripts
$ pre-commit install
Temporarily Disabling hooks
It's possible to disable hooks temporarily, but it isn't recommended.
$ SKIP=isort,black git commit -m <message>
Environments
Production
Please note that the production environment is currently not stable.
The production environment, deployed after a staging build of the main
branch is manually approved, can be accessed here: https://vax-availability-api.azurewebsites.net.
- Swagger: https://vax-availability-api.azurewebsites.net/swagger
- ReDoc: https://vax-availability-api.azurewebsites.net/redoc
- OpenAPI: https://vax-availability-api.azurewebsites.net/openapi.json
Staging
The staging environment, which is automatically deployed from the main
branch, can be accessed here: https://vax-availability-api-staging.azurewebsites.net.