add black, update for new isort

people updating from a previous build, make sure you run
pip install --reinstall requirements.check
This commit is contained in:
Damien Elmes 2019-12-23 10:31:47 +10:00
parent b51cf71d35
commit 9ebc15c748
5 changed files with 28 additions and 6 deletions

View file

@ -1,2 +1,8 @@
[settings]
skip=aqt/forms
multi_line_output=3
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=88
ensure_newline_before_comments=true

View file

@ -7,6 +7,7 @@ MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
RUNARGS :=
.SUFFIXES:
BLACKARGS := -t py36 anki aqt
$(shell mkdir -p .build)
@ -112,7 +113,7 @@ run: build
######################
.PHONY: check
check: mypy pyimports pytest pylint checkpretty
check: mypy pyimports pyfmt pytest pylint checkpretty
# Checking python
######################
@ -132,24 +133,32 @@ PYCHECKDEPS := $(BUILDDEPS) .build/pycheckreqs $(shell find anki aqt -name '*.py
touch $@
.build/pyimports: $(PYCHECKDEPS)
isort -rc anki aqt --check # if this fails, run 'make fixpyimports'
isort anki aqt --check # if this fails, run 'make fixpyimports'
touch $@
.build/pyfmt: $(PYCHECKDEPS)
black --check $(BLACKARGS) # if this fails, run 'make fixpyfmt'
touch $@
.build/pytype: $(PYCHECKDEPS) .build/pytypereqs
pytype --config pytype.conf
touch $@
.PHONY: mypy pytest pylint pytype pyimports fixpyimports
.PHONY: mypy pytest pylint pytype pyimports pyfmt
mypy: .build/mypy
pytest: .build/pytest
pylint: .build/pylint
pytype: .build/pytype
pyimports: .build/pyimports
pyfmt: .build/pyfmt
.PHONY: fixpyimports
.PHONY: fixpyimports fixpyfmt
fixpyimports:
isort -rc anki aqt
isort anki aqt
fixpyfmt:
black $(BLACKARGS) anki aqt
# Checking typescript
######################

View file

@ -12,5 +12,8 @@ if sys.version_info[0] < 3 or sys.version_info[1] < 5:
if sys.getfilesystemencoding().lower() in ("ascii", "ansi_x3.4-1968"):
raise Exception("Anki requires a UTF-8 locale.")
# fmt: off
version="2.1.17" # build scripts grep this line, so preserve formatting
# fmt: on
__all__ = ["Collection"]

View file

@ -9,10 +9,12 @@
# included implicitly in the past, and relied upon by some add-ons
import cgi
import decimal
# useful for add-ons
import logging
import logging.config
import logging.handlers
# required by requests library
import queue
import typing

View file

@ -2,4 +2,6 @@ nose
mock
mypy==0.750
pylint
isort
# fixme: when isort 5.0 is released, switch to pypy
git+https://github.com/dae/isort
black