-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1f3684f
commit c00abcb
Showing
8 changed files
with
65 additions
and
33 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,61 @@ | ||
VIRTUALENV := python3 -m venv | ||
PYTHON_BINARY := python3 | ||
VIRTUAL_BIN := venv/bin | ||
PROJECT_NAME := project_name | ||
|
||
## help - Display help about make targets for this Makefile | ||
help: | ||
@cat Makefile | grep '^## ' --color=never | cut -c4- | sed -e "`printf 's/ - /\t- /;'`" | column -s "`printf '\t'`" -t | ||
|
||
## venv - Install the virtual environment | ||
venv: | ||
$(VIRTUALENV) ~/.venv/project_name/ | ||
ln -snf ~/.venv/project_name/ venv | ||
venv/bin/pip install -e ."[dev]" | ||
## build - Builds the project in preparation for release | ||
build: | ||
$(PYTHON_BINARY) setup.py sdist bdist_wheel | ||
|
||
## install - Install the project locally | ||
install: | venv | ||
## coverage - Test the project and generate an HTML coverage report | ||
coverage: | ||
$(VIRTUAL_BIN)/pytest --cov=$(PROJECT_NAME) --cov-branch --cov-report=html --cov-report=term-missing | ||
|
||
## clean - Remove the virtual environment and clear out .pyc files | ||
clean: | ||
rm -rf ~/.venv/project_name/ venv | ||
rm -rf ~/.venv/$(PROJECT_NAME)/ venv | ||
find . -name '*.pyc' -delete | ||
rm -rf dist | ||
rm -rf build | ||
rm -rf *.egg-info | ||
|
||
## black - Runs the Black Python formatter against the project | ||
black: | ||
$(VIRTUAL_BIN)/black $(PROJECT_NAME)/ test/ | ||
|
||
## black-check - Checks if the project is formatted correctly against the Black rules | ||
black-check: | ||
$(VIRTUAL_BIN)/black $(PROJECT_NAME)/ test/ --check | ||
|
||
## format - Runs all formatting tools against the project | ||
format: black isort lint | ||
|
||
## format-check - Checks if the project is formatted correctly against all formatting rules | ||
format-check: black-check isort-check lint | ||
|
||
## install - Install the project locally | ||
install: | ||
$(PYTHON_BINARY) -m venv ~/.venv/$(PROJECT_NAME)/ | ||
ln -snf ~/.venv/$(PROJECT_NAME)/ venv | ||
$(VIRTUAL_BIN)/pip install -e ."[dev]" | ||
|
||
## isort - Sorts imports throughout the project | ||
isort: | ||
$(VIRTUAL_BIN)/isort $(PROJECT_NAME)/ test/ | ||
|
||
## isort-check - Checks that imports throughout the project are sorted correctly | ||
isort-check: | ||
$(VIRTUAL_BIN)/isort $(PROJECT_NAME)/ test/ --check-only | ||
|
||
## lint - Lint the project | ||
lint: | ||
venv/bin/flake8 project_name/*.py | ||
venv/bin/flake8 test/unit/*.py | ||
$(VIRTUAL_BIN)/flake8 $(PROJECT_NAME)/ test/ | ||
|
||
## test - Test the project | ||
test: | ||
venv/bin/pytest | ||
|
||
## coverage - Test the project and generate an HTML coverage report | ||
coverage: | ||
venv/bin/pytest --cov=project_name --cov-branch --cov-report=html --cov-report=term-missing | ||
$(VIRTUAL_BIN)/pytest | ||
|
||
.PHONY: help install clean lint test coverage | ||
.PHONY: help build coverage clean black black-check format format-check install isort isort-check lint test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[tool.black] | ||
experimental-string-processing = true | ||
line-length = 120 | ||
skip-string-normalization = true | ||
|
||
[tool.isort] | ||
profile = "black" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters