forked from Yubico/python-fido2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Yubico#2 from solokeys/black-with-prehooks
Black with prehooks
- Loading branch information
Showing
18 changed files
with
503 additions
and
440 deletions.
There are no files selected for viewing
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,6 @@ | ||
repos: | ||
- repo: https://github.com/psf/black | ||
rev: stable | ||
hooks: | ||
- id: black | ||
language_version: python3.7 |
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,18 +1,46 @@ | ||
.PHONY: standard-tests vendor-tests | ||
|
||
PY_VERSION=$(shell python -c "import sys; print('%d.%d'% sys.version_info[0:2])") | ||
VALID=$(shell python -c "print($(PY_VERSION) >= 3.6)") | ||
|
||
ifeq ($(OS),Windows_NT) | ||
BIN=venv/Scripts | ||
else | ||
BIN=venv/bin | ||
endif | ||
|
||
ifeq (True,$(VALID)) | ||
PYTHON=python | ||
else | ||
PYTHON=python3 | ||
endif | ||
|
||
standard-tests: venv | ||
venv/bin/pytest tests/standard | ||
$(BIN)/pytest tests/standard | ||
|
||
vendor-tests: venv | ||
venv/bin/pytest tests/vendor | ||
$(BIN)/pytest tests/vendor | ||
|
||
# setup development environment | ||
venv: | ||
python3 -m venv venv | ||
venv/bin/pip install -U pip | ||
venv/bin/pip install -U -r requirements.txt | ||
$(PYTHON) -m venv venv | ||
$(BIN)/python -m pip install -U pip | ||
$(BIN)/pip install -U -r requirements.txt | ||
$(BIN)/pip install -U -r dev-requirements.txt | ||
$(BIN)/pre-commit install | ||
|
||
# re-run if dependencies change | ||
update: | ||
venv/bin/pip install -U pip | ||
venv/bin/pip install -U -r requirements.txt | ||
$(BIN)/python -m pip install -U pip | ||
$(BIN)/pip install -U -r requirements.txt | ||
$(BIN)/pip install -U -r dev-requirements.txt | ||
|
||
# ensure this passes before commiting | ||
check: | ||
$(BIN)/black --check tests/ | ||
|
||
# automatic code fixes | ||
fix: black | ||
|
||
black: | ||
$(BIN)/black tests/ |
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,2 @@ | ||
black==18.9b0 # 19.3b0 has an issue on Windows | ||
pre-commit |
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
Oops, something went wrong.