add develop dependencies

This commit is contained in:
Dmitry Afanasyev 2022-08-13 15:23:00 +03:00
parent 908e300301
commit 7ac33d13a8
5 changed files with 1942 additions and 13 deletions

38
Makefile Normal file
View File

@ -0,0 +1,38 @@
PY_TARGET_DIRS=app # settings tests
PY_TARGET_FILES=
PORT=8000
.PHONY: app
app:
poetry run python app/main.py
# standard commands to run on every commit
format:
autoflake --recursive --ignore-init-module-imports --remove-all-unused-imports --remove-unused-variables --in-place $(PY_TARGET_DIRS)
pyupgrade --keep-runtime-typing $(PY_TARGET_FILES)
isort --color --quiet $(PY_TARGET_DIRS)
black $(PY_TARGET_DIRS) -S
check-style:
black --check $(PY_TARGET_DIRS) -S --diff --color
check-imports:
isort --check-only $(PY_TARGET_DIRS)
lint-typing:
mypy $(PY_TARGET_DIRS)
lint-complexity:
flake8 $(PY_TARGET_DIRS)
# special commands
lint-deps:
safety check --full-report
# docker commands
test-deps-up:
docker compose -f tests/docker-compose.yml up -d
test-deps-down:
docker compose -f tests/docker-compose.yml down -v

67
lefthook.yml Normal file
View File

@ -0,0 +1,67 @@
# Refer for explanation to following link:
# https://github.com/evilmartians/lefthook/blob/master/docs/full_guide.md
# NOTE: use `lefthook install` when you make change in stages (groups like pre-commit, format, etc.)
pre-commit:
commands:
format:
run: lefthook run format
lint:
run: lefthook run lint
check-format:
run: lefthook run check-format
pre-push:
parallel: true
commands:
isort:
glob: "*.py"
run: isort --check-only {all_files}
black:
glob: "*.py"
run: black --check {all_files}
mypy:
glob: "*.py"
run: mypy {all_files} --namespace-packages
flake8:
glob: "*.py"
run: flake8 {all_files}
format:
piped: true
parallel: false
commands:
# number prefix used to save ordering
1_autoflake:
glob: "*.py"
run: autoflake --recursive --ignore-init-module-imports --remove-all-unused-imports --remove-unused-variables --in-place {staged_files}
2_isort:
glob: "*.py"
run: isort --color --quiet {staged_files}
3_black:
glob: "*.py"
run: black {staged_files}
4_black_check:
glob: "*.py"
run: black --check {staged_files}
lint:
parallel: true
commands:
mypy:
glob: "*.py"
run: mypy {staged_files} --namespace-packages
flake8:
glob: "*.py"
run: flake8 {staged_files}
check-format:
parallel: true
commands:
isort:
glob: "*.py"
run: isort --check-only {staged_files}
black:
glob: "*.py"
run: black --check {staged_files}

1723
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "mosgortrans"
version = "0.1.0"
version = "0.7.1"
description = "Bot to help with mosgortans"
authors = ["Dmitry Afanasyev <Balshbox@gmail.com>"]
@ -13,9 +13,77 @@ wget = "^3.2"
loguru = "^0.6.0"
python-decouple = "^3.6"
apscheduler = "^3.9.1"
SQLAlchemy = {version = "^1.4", extras = ["mypy", "asyncio"]}
[tool.poetry.dev-dependencies]
ipython = "^8.2.0"
pre-commit = "^2.14.0"
safety = "^1.10.3"
yamllint = "^1.26.3"
tomlkit = "^0.7.2"
bandit = "1.7.4"
requests = "^2.26.0"
SQLAlchemy = {version = "^1.4", extras = ["mypy"]}
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
pyupgrade = "^2.24.0"
isort = "^5.9.3"
black = "^22.3.0"
mypy = "^0.961"
types-PyMySQL = "^1.0.11"
types-python-dateutil = "^2.8.4"
pytest = "^6.0"
pytest-asyncio = "^0.15.1"
pytest-deadfixtures = "^2.2.1"
pytest-testmon = "^1.1.2"
pytest-mock = "^3.6.1"
pytest-cov = "^2.12.1"
pytest-timeout = "^1.4.2"
pytest-sugar = "^0.9.4"
pytest-clarity = "^1.0.1"
pytest-env = "^0.6.2"
nest-asyncio = "^1.5.1"
autoflake = "^1.4"
flake8 = "^3.9"
flake8-logging-format = "^0.6.0"
flake8-comprehensions = "^3.6.1"
flake8-eradicate = "^1.1.0"
flake8-pytest-style = "^1.5.0"
flake8-aaa = "^0.12.0"
flake8-bugbear = "^21.4.3"
flake8-debugger = "^4.0.0"
flake8-expression-complexity = "^0.0.11"
flake8-fixme = "^1.1.1"
flake8-simplify = "^0.18.2"
flake8-variables-names = "^0.0.4"
flake8-bandit = "3.0.0"
flake8-tidy-imports = "^4.4.1"
[tool.isort]
profile = "black"
multi_line_output = 3
src_paths = ["LenokWinServer",]
[tool.mypy]
strict = true
ignore_missing_imports = true
allow_subclassing_any = true
allow_untyped_calls = true
pretty = true
show_error_codes = true
implicit_reexport = true
allow_untyped_decorators = true
warn_return_any = false
plugins = ["sqlalchemy.ext.mypy.plugin"]
[tool.coverage.run]
relative_files = true
[tool.pytest.ini_options]
filterwarnings = [
"error",
"ignore::DeprecationWarning",
]

51
setup.cfg Normal file
View File

@ -0,0 +1,51 @@
[flake8]
statistics = False
inline-quotes = single
max-line-length = 120
max-expression-complexity = 10
max-complexity = 10
ban-relative-imports = parents
nested-classes-whitelist = Config, Meta
docstring_style=reStructuredText
exclude =
tests/*,
./.git,
./venv,
ignore =
; use isort instead
I,
; use black style
E203, W
G004,
VNE003,
; conflict with fastapi di
B008,
per-file-ignores =
; too complex queries
*/repositories.py: ECE001
tests/*: TAE001, S101, S311
tests/*/factories/*: S5720
[mypy]
# Mypy configuration:
# https://mypy.readthedocs.io/en/latest/config_file.html
allow_redefinition = False
check_untyped_defs = True
disallow_untyped_decorators = False
disallow_any_explicit = False
disallow_any_generics = True
disallow_untyped_calls = True
disallow_untyped_defs = True
ignore_errors = False
ignore_missing_imports = True
implicit_reexport = False
local_partial_types = True
strict_optional = True
strict_equality = True
show_error_codes = True
no_implicit_optional = True
warn_unused_ignores = True
warn_redundant_casts = True
warn_unused_configs = True
warn_unreachable = True
warn_no_return = True