Implement new middlewares

This commit is contained in:
Alex Root Junior 2020-05-26 00:23:35 +03:00
parent c262cc0ce6
commit 7f26ec9935
29 changed files with 532 additions and 1252 deletions

View file

@ -6,7 +6,6 @@ python := $(py) python
reports_dir := reports
.PHONY: help
help:
@echo "======================================================================================="
@echo " aiogram build tools "
@ -45,12 +44,10 @@ help:
# Environment
# =================================================================================================
.PHONY: install
install:
$(base_python) -m pip install --user -U poetry
poetry install
.PHONY: clean
clean:
rm -rf `find . -name __pycache__`
rm -f `find . -type f -name '*.py[co]' `
@ -68,65 +65,56 @@ clean:
# Code quality
# =================================================================================================
.PHONY: isort
isort:
$(py) isort -rc aiogram tests
.PHONY: black
black:
$(py) black aiogram tests
.PHONY: flake8
flake8:
$(py) flake8 aiogram test
.PHONY: flake8-report
flake8-report:
mkdir -p $(reports_dir)/flake8
$(py) flake8 --format=html --htmldir=$(reports_dir)/flake8 aiogram test
.PHONY: mypy
mypy:
$(py) mypy aiogram
.PHONY: mypy-report
mypy-report:
$(py) mypy aiogram --html-report $(reports_dir)/typechecking
.PHONY: lint
lint: isort black flake8 mypy
# =================================================================================================
# Tests
# =================================================================================================
.PHONY: test
test:
$(py) pytest --cov=aiogram --cov-config .coveragerc tests/
.PHONY: test-coverage
test-coverage:
mkdir -p $(reports_dir)/tests/
$(py) pytest --cov=aiogram --cov-config .coveragerc --html=$(reports_dir)/tests/index.html tests/
test-coverage-report:
$(py) coverage html -d $(reports_dir)/coverage
.PHONY: test-coverage-report
test-coverage-report:
test-coverage-view:
$(py) coverage html -d $(reports_dir)/coverage
python -c "import webbrowser; webbrowser.open('file://$(shell pwd)/reports/coverage/index.html')"
# =================================================================================================
# Docs
# =================================================================================================
.PHONY: docs
docs:
$(py) mkdocs build
.PHONY: docs-serve
docs-serve:
$(py) mkdocs serve
.PHONY: docs-copy-reports
docs-copy-reports:
mv $(reports_dir)/* site/reports
@ -134,9 +122,7 @@ docs-copy-reports:
# Project
# =================================================================================================
.PHONY: build
build: clean flake8-report mypy-report test-coverage docs docs-copy-reports
mkdir -p site/simple
poetry build
mv dist site/simple/aiogram