Skip to content

alexnazarv/python-practice-field

Repository files navigation

Python practice field

Just a practice field for making, linting, testing and describing python projects and setting CI/CD for it.

Here is a Docker image that runs FastAPI server with two simple get and post methods.

TO DO:

CI:

Добавить правила для коммитов:

  • мануал шаг с деплоем на тест
  • мануал шаг с деплоем на прод

General:

  • Добавить test coverage
  • Описать все, что происходит в репо в шапке

Requirements

  • python ~3.10

Debug

Clone repo first:

git clone [email protected]:alexnazarv/training-project-api.git

Run without Docker

Install poetry:

pip install poetry==1.5.1

Move to project directory and make a venv:

cd training-project-api && poetry shell

Install dependencies and run the app:

poetry install && poetry run python3 -m app.main

Run with Docker

Build image and run container:

docker build . -t apicontainer -t apicontainer:test &&
docker run -d --rm --name apicontainer -p 8000:8000 apicontainer:test &&
docker rmi $(docker images -f "dangling=true" -q)

Clean up container and image:

docker rm -f apicontainer &&
docker rmi $(docker images apicontainer -q) -f

Run tests

poetry run python3 -m pytest --cov=app

Run linters

poetry run flake8 . && mypy . && isort .

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published