Skip to content

Commit 49ebd81

Browse files
committed
Update documentation and makefile
1 parent eeea03f commit 49ebd81

File tree

9 files changed

+48
-25
lines changed

9 files changed

+48
-25
lines changed
File renamed without changes.

Makefile

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ PYTHON = python3
2121

2222
# .PHONY defines parts of the makefile that are not dependant on any specific file
2323
# This is most often used to store functions
24-
.PHONY = help setup lint test debug clean
24+
.PHONY = help setup format lint test debug clean
2525

2626
# Defining an array variable
2727
FILES = input output
@@ -30,10 +30,12 @@ FILES = input output
3030
# This target is executed whenever we just type `make`
3131
.DEFAULT_GOAL = help
3232

33+
3334
# The @ makes sure that the command itself isn't echoed in the terminal
3435
help:
3536
@echo "$(BOLD_BLUE)-----------------------------MAKE GUIDE----------------------------$(RESET_STYLES)"
3637
@echo "$(BOLD_CYAN)make setup$(RESET_STYLES) : Setup pyflask-service"
38+
@echo "$(BOLD_CYAN)make format$(RESET_STYLES) : Format and fix python code pyflask-service"
3739
@echo "$(BOLD_CYAN)make lint$(RESET_STYLES) : Lint pyflask-service"
3840
@echo "$(BOLD_CYAN)make test$(RESET_STYLES) : Test pyflask-service"
3941
@echo "$(BOLD_CYAN)make debug$(RESET_STYLES) : Debug pyflask-service"
@@ -43,13 +45,39 @@ help:
4345
@echo "$(BOLD_BLUE)-------------------------------------------------------------------$(RESET_STYLES)"
4446

4547

46-
lint: #: Run static analysis with black, flake8, pylint, bandit and mypy
48+
setup: #: Use pip-tools, pip-compile, pip install
49+
@echo "$(BOLD_CYAN)Setting up pyflask base$(RESET_STYLES)"
50+
# Check for venv, conda else exit
51+
@echo "$(BOLD_CYAN)Installing pip-tools . . .$(RESET_STYLES)"
52+
pip install pip-tools
53+
@echo "$(BOLD_CYAN)Generating requirements$(RESET_STYLES)"
54+
pip-compile -q --build-isolation --output-file=requirements/requirements.txt requirements/requirements.in
55+
@echo "$(BOLD_CYAN)Generating dev requirements$(RESET_STYLES)"
56+
pip-compile -q --build-isolation --output-file=requirements/dev-requirements.txt requirements/dev-requirements.in
57+
@echo "$(BOLD_CYAN)Syncing requirements$(RESET_STYLES)"
58+
pip-sync -q requirements/requirements.txt requirements/dev-requirements.txt
59+
@echo "$(BOLD_CYAN)Installing requirements$(RESET_STYLES)"
60+
pip install -r requirements/requirements.txt
61+
@echo "$(BOLD_CYAN)Installing dev requirements$(RESET_STYLES)"
62+
pip install -r requirements/dev-requirements.txt
63+
64+
65+
format: #: Format and fix python code with black, isort, autoflake
4766
@echo "$(BOLD_CYAN)Blackifying $(RESET_STYLES)🍳"
67+
black --version
4868
black $(APP_DIR) $(TEST_DIR) $(HOME_DIR_PY_FILES)
4969
@echo "$(BOLD_CYAN)ISorting 〽️$(RESET_STYLES)"
5070
isort --recursive $(APP_DIR) $(TEST_DIR) $(HOME_DIR_PY_FILES)
5171
@echo "$(BOLD_CYAN)Flaking️❄️$(RESET_STYLES)"
72+
flake8 --version
73+
autoflake --remove-all-unused-imports --remove-unused-variables --remove-duplicate-keys --ignore-init-module-imports -i -r $(APP_DIR) $(TEST_DIR) $(HOME_DIR_PY_FILES)
74+
75+
76+
lint: #: Run static analysis with flake8, bandit and mypy
77+
@echo "$(BOLD_CYAN)Flake linting ❄️$(RESET_STYLES)"
78+
flake8 --version
5279
flake8 $(APP_DIR) $(TEST_DIR) $(HOME_DIR_PY_FILES)
53-
@echo "$(BOLD_CYAN)Securing️🕵️️$(RESET_STYLES)"
80+
@echo "$(BOLD_CYAN)Securing with bandit️🕵️️$(RESET_STYLES)"
81+
bandit --version
5482
bandit -l -i -r . --format=custom
5583

README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,17 @@ An "optionally opinionated and structured" flask boilerplate microservice for id
55
![Built with](https://img.shields.io/badge/-Built%20with-073551?style=flat-square)
66
![Python](https://img.shields.io/badge/-Python-3776AB?style=flat-square&logo=Python&logoColor=white)
77
![Flask](https://img.shields.io/badge/-Flask-000000?style=flat-square&logo=flask&logoColor=white)
8+
![License](https://img.shields.io/github/license/pritam001/pyflask-microservice-base?style=flat-square&label=License)
89

9-
Minimum supporting Python version: 3.6
10+
Tools
11+
------------------------------------------------------------------------------
12+
[![Min Python Version 3.6+](https://img.shields.io/badge/python-3.6+-3776AB.svg)](https://www.python.org/download/releases/3.6.0/)
13+
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
14+
[![PEP8](https://img.shields.io/badge/code%20style-pep8-orange.svg)](https://www.python.org/dev/peps/pep-0008/)
15+
[![security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)
1016

17+
Development Status
18+
------------------------------------------------------------------------------
1119
![WIP](https://img.shields.io/badge/%20%F0%9F%9A%A7%20-Work%20in%20progress-important)
1220

1321
Usage Guide
@@ -20,9 +28,16 @@ Steps for creating boilerplate project in GitHub
2028
0. `git clone https://www.github.com/username/my-pyflask-project.git`
2129
0. `cd my-pyflask-project`
2230
0. Create and activate conda environment `conda activate my-conda-venv` **
23-
0. `sh base_constructor.sh`
31+
0. `make setup` : Use pip-tools, pip-compile, pip install to setup python packages
2432

2533
\* [GitHub Guide: Creating a repository from a template](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template)
2634
<br>
2735
\** [Guide to Conda environment](https://github.com/pritam001/pyflask-microservice-base/blob/master/documentation/conda.md)
2836

37+
38+
39+
Linting Guide
40+
------------------------------------------------------------------------------
41+
`make format` : Format and fix python code with black, isort, autoflake
42+
43+
`make lint` : Run static analysis with flake8, bandit and mypy

documentation/bandit.md

Whitespace-only changes.

documentation/black.md

Whitespace-only changes.

documentation/flake8.md

Whitespace-only changes.

documentation/isort.md

Whitespace-only changes.

documentation/mypy.md

Whitespace-only changes.

scripts/base_constructor.sh

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)