Text summarization service with Python, FastAPI, and Docker.
Learn how to build, test, and deploy a text summarization microservice with Python, FastAPI and Docker.
fastapi-tdd-docker is a code-along to the course Test-Driven Development with FastAPI and Docker by Michael Herman.
Link to original repo.
├── .github
│ └── workflows
│ └── main.yml
├── .gitignore
├── README.md
├── docker-compose.yml
├── project
│ ├── .coverage
│ ├── .coveragerc
│ ├── .dockerignore
│ ├── Dockerfile
│ ├── Dockerfile.prod
│ ├── app
│ │ ├── __init__.py
│ │ ├── api
│ │ │ ├── __init__.py
│ │ │ ├── crud.py
│ │ │ ├── ping.py
│ │ │ └── summaries.py
│ │ ├── config.py
│ │ ├── db.py
│ │ ├── main.py
│ │ ├── models
│ │ │ ├── __init__.py
│ │ │ ├── pydantic.py
│ │ │ └── tortoise.py
│ │ └── summarizer.py
│ ├── db
│ │ ├── Dockerfile
│ │ └── create.sql
│ ├── entrypoint.sh
│ ├── htmlcov
│ ├── requirements-dev.txt
│ ├── requirements.txt
│ ├── setup.cfg
│ └── tests
│ ├── __init__.py
│ ├── conftest.py
│ ├── test_ping.py
│ ├── test_summaries.py
│ └── test_summaries_unit.py
└── release.sh
Prerequisites:
$ git clone https://github.com/kmjawadurrahman/fastapi-tdd-docker.git && cd fastapi-tdd-docker
$ docker-compose up -d --build
$ docker-compose exec web python app/db.py
$ docker-compose up -d
Go to http://localhost:8002/docs
.
$ docker-compose exec web-db psql -U postgres
$ docker-compose exec web python -m pytest
Unit Tests with Monkey-patching:
$ docker-compose exec web pytest -k "unit" -n auto