Skip to content

Commit

Permalink
chore(ci): add mypy workflow (#401)
Browse files Browse the repository at this point in the history
* add mypy workflow

* add mypy config

* fix mypy finding

* add mypy

* update config

* update lockfile
  • Loading branch information
CFenner authored Sep 23, 2024
1 parent afa951d commit da30371
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 3 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/type.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Type

# yamllint disable-line rule:truthy
on:
push:
branches:
- main
- master
pull_request:
workflow_dispatch:

env:
DEFAULT_PYTHON: "3.11"

jobs:
mypy:
name: mypy
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected]
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/[email protected]
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "poetry"
- name: 🏗 Install workflow dependencies
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: 🏗 Install dependencies
run: poetry install --no-interaction
- name: 🚀 Run mypy
run: poetry run mypy PyViCare tests
5 changes: 3 additions & 2 deletions PyViCare/PyViCareAbstractOAuthManager.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from abc import abstractclassmethod
from abc import abstractmethod
from typing import Any

from authlib.integrations.base_client import TokenExpiredError, InvalidTokenError
Expand Down Expand Up @@ -27,7 +27,8 @@ def oauth_session(self) -> OAuth2Session:
def replace_session(self, new_session: OAuth2Session) -> None:
self.__oauth = new_session

@abstractclassmethod
@classmethod
@abstractmethod
def renewToken(self) -> None:
return

Expand Down
60 changes: 59 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,46 @@ types-requests = ">=2.31"

[tool.poetry.group.dev.dependencies]
codespell = "^2.3.0"
mypy = "^1.11.2"
pylint = "^3.2.6"
pytest = "^8.3.2"
pytest-cov = "^5.0.0"
ruff = "^0.6.7"

[tool.mypy]
# Specify the target platform details in config, so your developers are
# free to run mypy on Windows, Linux, or macOS and get consistent
# results.
platform = "linux"
python_version = "3.11"

# show error messages from unrelated files
follow_imports = "normal"

# suppress errors about unsatisfied imports
ignore_missing_imports = true

# be strict
check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_subclassing_any = true
disallow_untyped_calls = true
disallow_untyped_decorators = true
disallow_untyped_defs = true
no_implicit_optional = true
strict_optional = true
warn_incomplete_stub = true
warn_no_return = true
warn_redundant_casts = true
warn_return_any = true
warn_unused_configs = true
warn_unused_ignores = true

[[tool.mypy.overrides]]
module = "authlib.*"
ignore_missing_imports = true

[tool.pylint."MESSAGES CONTROL"]
disable = [
"duplicate-code",
Expand Down

0 comments on commit da30371

Please sign in to comment.