Welcome to the La Cosa backend project! This guide will help you set up your development environment and run the application using Poetry, a powerful Python dependency management and packaging tool.
To get started, you'll need to install poetry. You can do this by running the following command in your terminal:
curl -sSL https://install.python-poetry.org | python3 -
You can verify the installation by checking the poetry version with poetry --version
Keep poetry up to date by running poetry self update
If you ever need to uninstall poetry, you can do so with the following commands:
curl -sSL https://install.python-poetry.org | python3 - --uninstall
curl -sSL https://install.python-poetry.org | POETRY_UNINSTALL=1 python3 -
To add a new Python dependency, simply use the following command: poetry add dependencyName
poetry install
installs all project dependencies.
poetry remove dependencyName
remove an installed dependency.
poetry env use 3.10
specify the desired Python version for your project. For example, to set it to Python 3.10
In the Makefile, you have the following targets:
make run
starts the Uvicorn server with the application. If it's not defined in the .env file, de default port is 8000.
make create-seed-data
Populates the database with 6 players and 1 game.
make delete-db
deletes the application's database file if it exists. It will request confirmation before deletion.
make test-all
runs the application's tests using pytest and tracks code coverage.
make coverage-report
generates code coverage reports and opens them in a web browser (Firefox)
make coverage-clean
deletes previously generated coverage reports.
make autopep8
formats all the Python files to the PEP8 standard.
make install
installs project dependencies and creates the virtual environment using poetry.
Remember to create a .env file with the necessary environment variables before using the Makefile
To know the necessary environment variables you can see the .env.example
file.
docker build -t backend-tuki .
docker run --name backend-tuki-container -p 8000:8000 backend-tuki
docker-compose up --build