- Notifications
You must be signed in to change notification settings - Fork2
Test Driven Development for web summarizer project with fastapi and implementing Containerization, CI/CD method, github action workflows and deployment
sanggusti/fastapi-tdd
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This project is delivering backend service of page summarizer using various stacks that are pivoting aroundfastapi,docker,postgresql,pytest andnltk. Dedicated to develop based on test driven as best practice in software development and also with Continuous Integration and Continuous Development.
For development :
Simply clone,docker-compose up -d --build and redirect tohttp://localhost:8004/docs. To do unit test, executedocker-compose exec python -m pytest.
For usage as service :
- Adding a new summary
$ http --json POST https://evening-brook-44287.herokuapp.com/summaries/ url=https://your_url.etcexample:
$ http --json POST http://localhost:8004/summaries/ url=http://testdriven.ioHTTP/1.1 201 Createdcontent-length: 34content-type: application/jsondate: Sun, 10 May 2020 15:59:54 GMTserver: uvicorn{ "id": 5, "url": "http://testdriven.io"}- Get the summary
$ http GET https://evening-brook-44287.herokuapp.com/summaries/{output_id}/example
$ http GET http://localhost:8004/summaries/5/HTTP/1.1 200 OKcontent-length: 134content-type: application/jsondate: Sun, 10 May 2020 16:00:09 GMTserver: uvicorn{ "created_at": "2020-05-10T15:59:55.098074", "id": 5, "summary": "", "url": "http://testdriven.io"}feel free to try hit this service as api to your webapp!
- Develop an asynchronous RESTful API with Python and FastAPI
- Practice Test-Driven Development
- Test a FastAPI app with pytest
- Interact with a Postgres database asynchronously
- Containerize FastAPI and Postgres inside a Docker container
- Run unit and integration tests with code coverage inside a Docker container
- Check your code for any code quality issues via a linter
- Configure GitHub Actions for continuous integration and deployment
- Use GitHub Packages to store Docker Images
- Speed up a Docker-based CI build with Docker Cache
- Deploy FastAPI, Uvicorn, and Postgres to Heroku with Docker
- Parameterize test functions and mock functionality in tests with pytest
- Run tests in parallel with pytest-xdist
- Document a RESTful API with Swagger/OpenAPI
- Run a background process outside the request/response flow
├── .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.shAbout
Test Driven Development for web summarizer project with fastapi and implementing Containerization, CI/CD method, github action workflows and deployment
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.