diff --git a/.github/actions/setup-python-build-env/action.yml b/.github/actions/setup-python-build-env/action.yml index 91d1ea58..1ca0ce0a 100644 --- a/.github/actions/setup-python-build-env/action.yml +++ b/.github/actions/setup-python-build-env/action.yml @@ -10,6 +10,4 @@ runs: python -m pip install --upgrade pip - name: Install Poetry shell: bash - run: | - pip install --user poetry - pip install "mypy==0.910" + run: pip install --user poetry diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index f229fd0a..0dd15823 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -22,8 +22,21 @@ jobs: run: | cp .env.dev.local .env - - name: Code Quality Check - shell: bash - run: | - cp template.Dockerfile iso15118/secc/Dockerfile - docker-compose build secc + - name: Install dependencies + run: make install-local + +# TODO: Fix MyPy issues https://github.com/SwitchEV/iso15118/issues/93 +# - name: Mypy +# run: make mypy + + - name: Black + run: make black + + - name: Flake8 + run: make flake8 + + - name: isort + run: make isort + + - name: Tests + run: make test diff --git a/Makefile b/Makefile index 070f8253..155f2823 100644 --- a/Makefile +++ b/Makefile @@ -97,23 +97,27 @@ test-secc: # Run pytest test: - pytest tests + poetry run pytest -vv --cov-config .coveragerc --cov-report term-missing --durations=3 --cov=. # Run mypy checks mypy: - mypy --config-file mypy.ini iso15118 tests + poetry run mypy --config-file mypy.ini iso15118 tests # Reformat with isort and black reformat: - isort iso15118 tests && black --line-length=88 iso15118 tests + poetry run isort iso15118 tests && poetry run black --line-length=88 iso15118 tests # Run black checks black: - black --check --diff --line-length=88 iso15118 tests + poetry run black --check --diff --line-length=88 iso15118 tests + +# Run isort checks +isort: + poetry run isort --check-only iso15118 tests # Run flake8 checks flake8: - flake8 --config .flake8 iso15118 tests + poetry run flake8 --config .flake8 iso15118 tests # Run black, isort, mypy, & flake8 code-quality: reformat mypy flake8 diff --git a/poetry.lock b/poetry.lock index f75a0fb6..df4a880a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -219,6 +219,24 @@ category = "dev" optional = false python-versions = "*" +[[package]] +name = "mypy" +version = "0.982" +description = "Optional static typing for Python" +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +mypy-extensions = ">=0.4.3" +tomli = {version = ">=1.1.0", markers = "python_version < \"3.11\""} +typing-extensions = ">=3.10" + +[package.extras] +dmypy = ["psutil (>=4.0)"] +python2 = ["typed-ast (>=1.4.0,<2)"] +reports = ["lxml"] + [[package]] name = "mypy-extensions" version = "0.4.3" @@ -453,7 +471,7 @@ python-versions = ">=3.7" [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "e5d9d96199fb2b172e8460c2ad0b0e1841597b765fba23befbcd18a8e42d75dd" +content-hash = "145d5dc5773a8c43984ba848c964638d49624f4062d5d8ef818d79967b21c925" [metadata.files] aiofile = [ @@ -686,6 +704,32 @@ mccabe = [ {file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"}, {file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"}, ] +mypy = [ + {file = "mypy-0.982-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:5085e6f442003fa915aeb0a46d4da58128da69325d8213b4b35cc7054090aed5"}, + {file = "mypy-0.982-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:41fd1cf9bc0e1c19b9af13a6580ccb66c381a5ee2cf63ee5ebab747a4badeba3"}, + {file = "mypy-0.982-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f793e3dd95e166b66d50e7b63e69e58e88643d80a3dcc3bcd81368e0478b089c"}, + {file = "mypy-0.982-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:86ebe67adf4d021b28c3f547da6aa2cce660b57f0432617af2cca932d4d378a6"}, + {file = "mypy-0.982-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:175f292f649a3af7082fe36620369ffc4661a71005aa9f8297ea473df5772046"}, + {file = "mypy-0.982-cp310-cp310-win_amd64.whl", hash = "sha256:8ee8c2472e96beb1045e9081de8e92f295b89ac10c4109afdf3a23ad6e644f3e"}, + {file = "mypy-0.982-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:58f27ebafe726a8e5ccb58d896451dd9a662a511a3188ff6a8a6a919142ecc20"}, + {file = "mypy-0.982-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d6af646bd46f10d53834a8e8983e130e47d8ab2d4b7a97363e35b24e1d588947"}, + {file = "mypy-0.982-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:e7aeaa763c7ab86d5b66ff27f68493d672e44c8099af636d433a7f3fa5596d40"}, + {file = "mypy-0.982-cp37-cp37m-win_amd64.whl", hash = "sha256:724d36be56444f569c20a629d1d4ee0cb0ad666078d59bb84f8f887952511ca1"}, + {file = "mypy-0.982-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:14d53cdd4cf93765aa747a7399f0961a365bcddf7855d9cef6306fa41de01c24"}, + {file = "mypy-0.982-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:26ae64555d480ad4b32a267d10cab7aec92ff44de35a7cd95b2b7cb8e64ebe3e"}, + {file = "mypy-0.982-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:6389af3e204975d6658de4fb8ac16f58c14e1bacc6142fee86d1b5b26aa52bda"}, + {file = "mypy-0.982-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7b35ce03a289480d6544aac85fa3674f493f323d80ea7226410ed065cd46f206"}, + {file = "mypy-0.982-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:c6e564f035d25c99fd2b863e13049744d96bd1947e3d3d2f16f5828864506763"}, + {file = "mypy-0.982-cp38-cp38-win_amd64.whl", hash = "sha256:cebca7fd333f90b61b3ef7f217ff75ce2e287482206ef4a8b18f32b49927b1a2"}, + {file = "mypy-0.982-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:a705a93670c8b74769496280d2fe6cd59961506c64f329bb179970ff1d24f9f8"}, + {file = "mypy-0.982-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:75838c649290d83a2b83a88288c1eb60fe7a05b36d46cbea9d22efc790002146"}, + {file = "mypy-0.982-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:91781eff1f3f2607519c8b0e8518aad8498af1419e8442d5d0afb108059881fc"}, + {file = "mypy-0.982-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eaa97b9ddd1dd9901a22a879491dbb951b5dec75c3b90032e2baa7336777363b"}, + {file = "mypy-0.982-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a692a8e7d07abe5f4b2dd32d731812a0175626a90a223d4b58f10f458747dd8a"}, + {file = "mypy-0.982-cp39-cp39-win_amd64.whl", hash = "sha256:eb7a068e503be3543c4bd329c994103874fa543c1727ba5288393c21d912d795"}, + {file = "mypy-0.982-py3-none-any.whl", hash = "sha256:1021c241e8b6e1ca5a47e4d52601274ac078a89845cfde66c6d5f769819ffa1d"}, + {file = "mypy-0.982.tar.gz", hash = "sha256:85f7a343542dc8b1ed0a888cdd34dca56462654ef23aa673907305b260b3d746"}, +] mypy-extensions = [ {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, diff --git a/pyproject.toml b/pyproject.toml index 4d7df357..baabd3b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,9 @@ pytest-cov = "^3.0.0" aiofile = "^3.7.4" toml = "0.10.2" +[tool.poetry.group.dev.dependencies] +mypy = "^0.982" + [tool.isort] profile = "black"