Cherrytrack
A microservice which defines the database used to store automation system run information and exposes endpoints to ease querying.
Table of Contents
- Requirements for Development
- Getting Started
- Running
- Testing
- Formatting, Linting and Type Checking
- Deployment
- Miscellaneous
Requirements for Development
The following tools are required for development:
- python (use
pyenv
or something similar to install the python version specified in thePipfile
) - mySQL 8.0 (a
docker-compose.yml
is included to easily get the database server up and running)
Getting Started
Setup Steps
Install the require dependencies:
pipenv install --dev
Create the following database (currently manually):
psd_cherrytrack_dev
To generate dummy data for this project you can use SQL statements from:
- Biosero-SQL.
In particular see biosero-sql/example-queries which can be run manually on
psd_cherrytrack_dev
Migrations
Flask Migrate is a wrapper around Alembic
To check the current state of the migrations, run:
flask db current
To run the migrations:
flask db upgrade
Running
To run the application:
flask run
Testing
Testing Requirements
Create the following database (currently manually):
psd_cherrytrack_test
Migrate the test database:
SETTINGS_PATH=config/test.py flask db upgrade
Running Tests
To run the test suite:
python -m pytest
Formatting, Linting and Type Checking
Formatting
This project is formatted using black. To run formatting checks, run:
pipenv run black .
Linting
This project is linted using flake8. To lint the code, run:
pipenv run flake8
Type Checking
This project uses static type checking using the mypy library, to run:
pipenv run mypy .
Deployment
This project uses a Docker image as the unit of deployment. To create a release for deployment, create a release in GitHub and wait for the GitHub action to create the Docker image.
The release version should align with the standards.
Miscellaneous
Updating the Table of Contents
To update the table of contents after adding things to this README you can use the markdown-toc node module. To run:
npx markdown-toc -i README.md