Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved Makefile, venv,clean,tests,lint,format and help #15

Merged
merged 1 commit into from
May 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 48 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,57 @@
.PHONY: help prepare-dev run-dev
.DEFAULT: help

VENV_NAME?=venv
VENV_ACTIVATE=. $(VENV_NAME)/bin/activate
PYTHON=${VENV_NAME}/bin/python3

.PHONY: help
help:
# TODO add help
@echo 'Makefile for "Auto README for Terraform"'
@echo ''
@echo ' prepare-dev - Installs required Python packages via Pip.'
@echo ' run - Run main.py'
@echo ' create-venv - Create virtual environment.'
@echo ' remove-venv - Remove the virutal environment.'
@echo ' lint - Run flake8 to lint your Python code.'
@echo ' format - Run autopep8 to format Python code.'
@echo ' all-tests - Run all tests in test files.'
@echo ' clean - Clean Python cache files.'

.PHONY: prepare-dev
prepare-dev:
# TODO add prepare-dev
run-dev:
pip3 install flake8
pip3 install autopep8
pip3 install virtualenv

.PHONY: create-venv
create-venv:
virtualenv $(VENV_NAME)
source $(VENV_ACTIVATE)
pip3 install -r src/requirements.txt

.PHONY: remove-venv
remove-venv:
rm -rf $(VENV_NAME)

.PHONY: run-dev
run:
cd src; \
python3 main.py --path "../module"
python3 main.py --path "../tests/"

.PHONY: lint
lint:
flake8 src/ --ignore=E501,W504,E128

.PHONY: format
format:
autopep8 --in-place --aggressive --aggressive .

.PHONY: all-tests
all-tests:
cd src; \
pytest

.PHONY: clean
clean:
find -type d -name ".pytest_cache" -exec rm -rf {} +
find -type d -name "__pycache__" -exec rm -rf {} +