Skip to content

Commit faa2bba

Browse files
author
Shaun B
committed
Update README.md
1 parent 2a4074d commit faa2bba

File tree

2 files changed

+120
-9
lines changed

2 files changed

+120
-9
lines changed

README2.md

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Article Summarizer
2+
> Article Summarizer is an asynchronous RESTful API built with Python and FastAPI. It utilizes Newspaper3k to provide real-time text summarization from a given URL.
3+
4+
![CI/CD][gh-actions-image]
5+
6+
## Development setup
7+
8+
First, install the system dependencies:
9+
* [docker](https://docs.docker.com/)
10+
* [docker-compose](https://docs.docker.com/compose/)
11+
* [git](https://git-scm.com/)
12+
* [make](https://www.gnu.org/software/make/)
13+
14+
Second, download the source code
15+
```sh
16+
git clone https://github.com/sbathgate/fastapi-tdd-docker.git
17+
cd fastapi-tdd-docker/
18+
```
19+
20+
Third, build the project image.
21+
```sh
22+
make build
23+
```
24+
25+
## Technologies
26+
* Python 3.8
27+
* FastAPI
28+
* PostgreSQL
29+
* Heroku
30+
* Gunicorn
31+
* Tortoise-ORM
32+
* Newspaper3k
33+
* Pytest
34+
* Black
35+
* Flake8
36+
* iSort
37+
38+
## File Structure
39+
### Within the download you'll find the following directories and files:
40+
```
41+
├── .github
42+
│ └── workflows
43+
│ └── main.yml
44+
├── .gitignore
45+
├── README.md
46+
├── docker-compose.yml
47+
├── makefile
48+
├── project
49+
│ ├── .coverage
50+
│ ├── .coveragerc
51+
│ ├── .dockerignore
52+
│ ├── Dockerfile
53+
│ ├── Dockerfile.prod
54+
│ ├── app
55+
│ │ ├── __init__.py
56+
│ │ ├── api
57+
│ │ │ ├── __init__.py
58+
│ │ │ ├── crud.py
59+
│ │ │ ├── ping.py
60+
│ │ │ └── summaries.py
61+
│ │ ├── config.py
62+
│ │ ├── db.py
63+
│ │ ├── main.py
64+
│ │ ├── models
65+
│ │ │ ├── __init__.py
66+
│ │ │ ├── pydantic.py
67+
│ │ │ └── tortoise.py
68+
│ │ └── summarizer.py
69+
│ ├── db
70+
│ │ ├── Dockerfile
71+
│ │ └── create.sql
72+
│ ├── entrypoint.sh
73+
│ ├── htmlcov
74+
│ ├── requirements-dev.txt
75+
│ ├── requirements.txt
76+
│ ├── setup.cfg
77+
│ └── tests
78+
│ ├── __init__.py
79+
│ ├── conftest.py
80+
│ ├── test_ping.py
81+
│ ├── test_summaries.py
82+
│ └── test_summaries_unit.py
83+
└── release.sh
84+
```
85+
86+
## Release History
87+
88+
* 0.1.0
89+
* Initial release
90+
91+
## Acknowledgements
92+
This project wouldn't have been possible without the excellent [Test-Driven Development with FastAPI and Docker course](https://testdriven.io/courses/tdd-fastapi/) developed by [Michael Herman](https://mherman.org/) on [testdriven.io](https://testdriven.io). You can also find a free tutorial on their blog [Developing and Testing an Asynchronous API with FastAPI and Pytest](https://testdriven.io/blog/fastapi-crud/).
93+
94+
## Contributing
95+
96+
1. Fork it (<https://github.com/sbathgate/article-summarizer/fork>)
97+
2. Create your feature branch (`git checkout -b feature/fooBar`)
98+
3. Commit your changes (`git commit -am 'Add some fooBar'`)
99+
4. Push to the branch (`git push origin feature/fooBar`)
100+
5. Create a new Pull Request
101+
102+
<!-- Markdown link & img dfn's -->
103+
[gh-actions-image]: https://github.com/sbathgate/fastapi-tdd-docker/workflows/CI/badge.svg?branch=master

makefile

+17-9
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,32 @@
1-
default: help
1+
default: build
2+
3+
build: ## Build the docker containers
4+
docker-compose build
5+
rebuild-db
6+
test
27

38
help: ## Output available commands
49
@echo "Available commands:"
510
@echo
611
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
712

8-
lint-check:
13+
lint-check: ## Conduct lint checks
914
@docker-compose exec web flake8 .
1015
@echo "flake8 complete!"
1116
@docker-compose exec web black . --check
1217
@echo "black complete!"
1318
@docker-compose exec web /bin/sh -c "isort ./**/*.py --check-only"
1419
@echo "isort complete!"
1520

16-
lint-correct:
21+
lint-correct: ## Correct lint issues
1722
@docker-compose exec web flake8 .
1823
@echo "flake8 complete!"
1924
@docker-compose exec web black .
2025
@echo "black complete!"
2126
@docker-compose exec web /bin/sh -c "isort ./**/*.py"
2227
@echo "isort complete!"
2328

24-
lint-diff:
29+
lint-diff: ## Display differences in lint
2530
@docker-compose exec web flake8 .
2631
@echo "flake8 complete!"
2732
@docker-compose exec web black . --diff
@@ -40,12 +45,15 @@ rebuild: ## Rebuild docker images
4045
rebuild-db: ## Rebuild db in docker image
4146
@docker-compose exec web python app/db.py
4247

48+
start: # Start docker containers
49+
@docker-compose up -d
50+
4351
test: ## Run the current test suite
4452
@docker-compose exec web python -m pytest --cov="."
4553

4654
test-routes: ## Test routes using HTTPie
47-
@http GET https://immense-island-91665.herokuapp.com/summaries/
48-
@http GET https://immense-island-91665.herokuapp.com/summaries/1/
49-
@http --json POST https://immense-island-91665.herokuapp.com/summaries/ url=https://shaunb.ca
50-
@http --json PUT https://immense-island-91665.herokuapp.com/summaries/3/ url=https://shaunb.ca summary=super
51-
@http DELETE https://immense-island-91665.herokuapp.com/summaries/3/
55+
@echo "Get all: http GET <HOST_URL>/summaries/"
56+
@echo "Get one: http GET <HOST_URL>/summaries/<id>"
57+
@echo "Add Summary: http --json POST <HOST_URL>/summaries/ url=https://shaunb.ca"
58+
@echo "Change Summary: http --json PUT <HOST_URL>/summaries/ url=https://shaunb.ca summary=super"
59+
@echo "Get one: http DELETE <HOST_URL>/summaries/<id>"

0 commit comments

Comments
 (0)