Skip to content

Commit

Permalink
feat(build): run Python lint during CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Feb 6, 2023
1 parent 69ebb1c commit 79eaad6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
14 changes: 9 additions & 5 deletions api/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
onnx_env: ## create virtual env
python -v venv onnx_env

ci: pip
pip install coverage hypothesis
ci: pip pip-dev lint-check
$(MAKE) test

pip:
check-venv:
if [ -z $${VIRTUAL_ENV+x} ]; then echo "Are you sure you want to install dependencies outside of a virtual environment?"; sleep 30; fi

pip: check-venv
pip install -r requirements.txt

pip-dev: check-venv
pip install -r requirements.txt

test:
Expand All @@ -25,12 +29,12 @@ package-upload:
twine upload dist/*

lint-check:
black --check --preview onnx_web
black --check --preview onnx_web/
isort --check-only --skip __init__.py --filter-files onnx_web
flake8 onnx_web

lint-fix:
black onnx_web
black onnx_web/
isort --skip __init__.py --filter-files onnx_web
flake8 onnx_web

Expand Down
6 changes: 6 additions & 0 deletions api/dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# lint
black
flake8
isort
mypy

# testing
coverage
hypothesis

# types
types-Flask-Cors
types-jsonschema
types-Pillow
Expand Down
4 changes: 4 additions & 0 deletions api/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[tool.black]
force-exclude = '''/(lpw_stable_diffusion_onnx|pipeline_onnx_stable_diffusion_upscale).py'''

[tool.isort]
profile = "black"
force_to_top = ".logging"
skip_glob = ["*/lpw_stable_diffusion_onnx.py", "*/pipeline_onnx_stable_diffusion_upscale.py"]
5 changes: 4 additions & 1 deletion api/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ description-file = README.md
[flake8]
ignore = E203, W503
max-line-length = 160
per-file-ignores = __init__.py:F401
per-file-ignores = __init__.py:F401
exclude =
onnx_web/diffusion/lpw_stable_diffusion_onnx.py
onnx_web/diffusion/pipeline_onnx_stable_diffusion_upscale.py

0 comments on commit 79eaad6

Please sign in to comment.