2020-10-13 21:02:40 +02:00
# Didier
2022-07-14 20:28:45 +02:00
[![wakatime ](https://wakatime.com/badge/user/3543d4ec-ec93-4b43-abd6-2bc2e310f3c4/project/100156e4-2fb5-40b4-b808-e47ef687905c.svg )](https://wakatime.com/badge/user/3543d4ec-ec93-4b43-abd6-2bc2e310f3c4/project/100156e4-2fb5-40b4-b808-e47ef687905c)
2020-10-13 21:02:40 +02:00
You bet. The time has come.
2022-07-19 21:33:18 +02:00
## Development
2020-10-13 21:02:40 +02:00
2022-07-19 21:33:18 +02:00
Didier uses `Python 3.9.5` , as specified in the [`.python-version` ](.python-version )-file. This file will cause [`pyenv` ](https://github.com/pyenv/pyenv ) to automatically use the correct version when you're working on Didier.
2020-10-13 21:02:40 +02:00
2022-07-19 21:33:18 +02:00
```shell
# Installing Python 3.9.5 through pyenv
pyenv install 3.9.5
2020-10-13 21:02:40 +02:00
2022-07-19 21:33:18 +02:00
# Creating a Virtual Environment and activate it
# PyCharm will automatically activate your venv
python3 -m venv venv
source venv/bin/activate
2020-10-13 21:02:40 +02:00
2022-07-19 21:33:18 +02:00
# Installing dependencies + development dependencies
pip3 install -r requirements.txt -r requirements-dev.txt
2020-10-13 21:02:40 +02:00
2022-07-19 21:33:18 +02:00
# Installing pre-commit hooks
pre-commit install
2020-10-13 21:02:40 +02:00
```
2022-07-19 21:33:18 +02:00
The database can be managed easily using `Docker Compose` . If you want to, however, you can run a regular PostgreSQL server and connect to that instead.
2020-10-13 21:02:40 +02:00
2022-07-19 21:33:18 +02:00
A separate database is used in the tests, as it would obviously not be ideal when tests randomly wipe your database.
2020-10-13 21:02:40 +02:00
2022-07-19 21:33:18 +02:00
```shell
# Starting the database
docker-compose up -d db
2020-10-13 21:02:40 +02:00
2022-07-19 21:33:18 +02:00
# Starting the database used in tests
docker-compose up -d db-pytest
2020-10-13 21:02:40 +02:00
```
2022-07-19 21:33:18 +02:00
### Commands
2020-10-13 21:02:40 +02:00
2022-07-19 21:33:18 +02:00
```shell
# Starting Didier
python3 main.py
2020-10-13 21:02:40 +02:00
2022-07-19 22:58:59 +02:00
# Running database migrations
alembic upgrade head
# Creating a new database migration
alembic revision --autogenerate -m "Revision message here"
2022-07-19 21:33:18 +02:00
# Running tests
pytest
2020-10-13 21:02:40 +02:00
2022-07-19 21:33:18 +02:00
# Running tests with Coverage
coverage run -m pytest
# Generating code coverage report
coverage html
2020-10-13 21:02:40 +02:00
2022-07-19 21:33:18 +02:00
# Running code quality checks
black
flake8
mypy
```