A simple Python project to get you started with web development and testing using Docker and GitHub Actions.
- Python 3.9
- Docker
- Docker Compose
- Poetry
git clone https://github.com/yourusername/hackathon-starter.git
cd hackathon-starterDB_USER=postgres
DB_PASS=postgres
DB_HOST=db
DB_NAME=postgres
DB_PORT=5432
POSTGRES_PASSWORD=postgrespoetry shelldocker compose --env-file .env up --buildpytest test/test_api.py # to test the API
docker exec hackathon-starter-web-1 poetry run pytest tests/test_database.py # to test the database inside the containerOr run all tests with docker exec -it hackathon-starter-web-1 pytest
docker compose downTo create new table in database just create needed class in src/model/tables.py similar to Example class.
If you want to change table, just look for your table in src/model/tables.py and do needed changes.
After creating or updating tables create new migration.
To create new migration simply run
alembic revision --autogenerate -m "example comment"
alembic upgrade head
We are using following tools:
- black - to run use
make black - isort - to run use
make isort - pylint - to run use
make pylint
If you want to lint every file using all at once you can also run make lint
Beside that you can also use pre-commit.
pre-commit install
pre-commit run --all-files
This project uses GitHub Actions for CI.
The workflow is defined in .github/workflows/main.yml.
It sets up a Python environment, installs the dependencies, runs Docker Compose, and runs the tests.
The workflow is triggered on every push to the main branch.
To use GitHub Actions in your repository, you need to add secrets to your repository settings:
DB_HOSTDB_USERDB_PASSDB_NAME
This project is licensed under the terms of the MIT license. See the LICENSE file for details.