From 162a66e6631692d12800ca00d53780ef5368c690 Mon Sep 17 00:00:00 2001 From: Sam Woodard Date: Thu, 12 May 2022 11:51:08 -0700 Subject: [PATCH] fix: use py 3.9 and fix mypy (#57) * fix: update .github workflows to use py 3.9 * fix: static type checker mypy needs these changes typing.List is better than typing.Sequence, apparently in loaders.py and install the types packages for Markdown and Python. * fix: mypy fails because needs deps in setyp.py We need to install the package even though it is a static checker because it relies on some installed packages that contain type declarations. Fixes: #56 --- .github/workflows/release.yaml | 4 ++-- .github/workflows/test.yaml | 10 ++++++---- aip_site/jinja/loaders.py | 2 +- setup.py | 2 ++ 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index abd0a0d..c32298d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -6,7 +6,7 @@ on: jobs: inspect: runs-on: ubuntu-latest - container: python:3.8 + container: python:3.9 steps: - uses: actions/checkout@v2 with: @@ -37,7 +37,7 @@ jobs: prerelease: false pypi_release: runs-on: ubuntu-latest - container: python:3.8 + container: python:3.9 needs: - inspect - github_release diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index a72f8ed..a099ed6 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -6,7 +6,7 @@ on: jobs: tests: runs-on: ubuntu-latest - container: python:3.8 + container: python:3.9 steps: - uses: actions/checkout@v2 - name: Install package. @@ -17,7 +17,7 @@ jobs: run: pytest build: runs-on: ubuntu-latest - container: python:3.8 + container: python:3.9 steps: - uses: actions/checkout@v2 - name: Install package. @@ -26,7 +26,7 @@ jobs: run: aip-site-gen tests/test_data/ /out/ lint: runs-on: ubuntu-latest - container: python:3.8 + container: python:3.9 steps: - uses: actions/checkout@v2 - name: Install the linter (flake8). @@ -35,9 +35,11 @@ jobs: run: flake8 aip_site/ tests/ mypy: runs-on: ubuntu-latest - container: python:3.8 + container: python:3.9 steps: - uses: actions/checkout@v2 + - name: Install package. + run: pip install . - name: Install mypy. run: pip install mypy - name: Run mypy. diff --git a/aip_site/jinja/loaders.py b/aip_site/jinja/loaders.py index 9443373..b8d9cae 100644 --- a/aip_site/jinja/loaders.py +++ b/aip_site/jinja/loaders.py @@ -74,7 +74,7 @@ def get_source(self, env, template: str) -> typing.Tuple[str, str, None]: # Return the template information. return contents, fn, None - def list_templates(self) -> typing.Sequence[str]: + def list_templates(self) -> typing.List[str]: answer = [] # We sort the files in the directory to read more specific diff --git a/setup.py b/setup.py index 928602d..e5fc1dc 100644 --- a/setup.py +++ b/setup.py @@ -55,6 +55,8 @@ 'pyscss==1.3.7', 'pyyaml==5.4.1', 'six==1.16.0', + 'types-Markdown==3.3.15', + 'types-PyYAML==6.0.7', 'werkzeug==2.0.1', ), python_requires='>=3.8',