Go to file
Stijn De Clercq 3ca4520e56 Stash 2023-09-17 16:34:30 +02:00
.github Update CI & fix broken test 2023-01-11 23:37:39 +01:00
alembic Migrate database 2023-07-07 16:23:36 +02:00
database Stash 2023-09-17 16:34:30 +02:00
didier Fix typing everywhere, fetch error channel after bot is ready 2023-07-08 15:38:17 +02:00
profile_pictures Typing 2022-09-24 17:01:58 +02:00
tests Remove wordle 2023-07-07 14:51:50 +02:00
.editorconfig Initialize database stuff & setup didier 2022-06-10 01:48:02 +02:00
.flake8 Fix db script runner 2022-10-19 22:37:17 +02:00
.gitignore Merge migrations, pull schedules daily 2022-09-17 19:22:27 +02:00
.pre-commit-config.yaml Update all dependencies, move to pydantic 2.x and sqlalchemy 2.x 2023-07-07 16:16:33 +02:00
.python-version Bump python version 2021-06-20 11:45:34 +02:00
alembic.ini Add missing alembic file 2022-06-16 00:40:37 +02:00
codecov.yaml Urban dictionary commands 2022-07-14 20:28:45 +02:00
docker-compose.test.yml Remove mongo & fix tests 2022-08-29 20:24:42 +02:00
docker-compose.yml Remove mongo & fix tests 2022-08-29 20:24:42 +02:00
main.py Fix file handler type 2023-07-16 22:16:32 +02:00
pyproject.toml Fix db typing 2023-07-08 01:23:47 +02:00
readme.md Add OS info to dev readme 2022-08-29 01:17:06 +02:00
requirements-dev.txt Update all dependencies, move to pydantic 2.x and sqlalchemy 2.x 2023-07-07 16:16:33 +02:00
requirements.txt Fix db typing 2023-07-08 01:23:47 +02:00
run_db_scripts.py Fix db script runner 2022-10-19 22:37:17 +02:00
settings.py Fix typing everywhere, fetch error channel after bot is ready 2023-07-08 15:38:17 +02:00

readme.md

Didier

wakatime

You bet. The time has come.

Development

Didier uses Python 3.9.5, as specified in the .python-version-file. This file will cause pyenv to automatically use the correct version when you're working on Didier.

# Installing Python 3.9.5 through pyenv
pyenv install 3.9.5

# Creating a Virtual Environment and activate it
# PyCharm will automatically activate your venv
python3 -m venv venv
source venv/bin/activate

# Installing dependencies + development dependencies
pip3 install -r requirements.txt -r requirements-dev.txt

# Installing pre-commit hooks
pre-commit install

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.

A separate database is used in the tests, as it would obviously not be ideal when tests randomly wipe your database.

# Starting the database
docker compose up -d

# Starting the database used in tests
docker compose -f docker-compose.test.yml up -d

Commands

All of these are Python tools. Depending on your OS and configuration, you may have to prefix them with python3 -m.

# Starting Didier
python3 main.py

# Running database migrations
alembic upgrade head

# Creating a new database migration
alembic revision --autogenerate -m "Revision message here"

# Running tests
pytest

# Running tests with Coverage
coverage run -m pytest
# Generating code coverage report
coverage html

# Running code quality checks
black
flake8
mypy

It's also convenient to have code-formatting happen automatically on-save. The Black documentation explains how to set this up for different types of editors.