From 81b8b009c64a054d3096183b05ea5d9cbfb23473 Mon Sep 17 00:00:00 2001 From: Daniel Copley Date: Tue, 14 May 2024 18:08:17 -0700 Subject: [PATCH] Add mypy CI job --- .github/workflows/lint.yml | 21 +++++++++++++++++++-- pyproject.toml | 7 +++++-- src/shelloracle/bootstrap.py | 2 +- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ef06d34..af177b0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,8 +1,25 @@ -name: Ruff -on: [ push, pull_request ] +name: Lint +on: + push: + pull_request: +permissions: + contents: read + jobs: ruff: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: chartboost/ruff-action@v1 + mypy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-python@v5 + with: + python-version: "3.x" + - uses: pypa/hatch@install + - name: Run mypy + run: hatch run types:check diff --git a/pyproject.toml b/pyproject.toml index 755ce3d..10b57e1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -66,7 +66,10 @@ extra-dependencies = [ ] [tool.hatch.envs.types.scripts] -check = "mypy --install-types --non-interactive --explicit-package-bases {args:src/shelloracle tests}" +check = [ + "mypy {args:src/shelloracle}", + "mypy --explicit-package-bases tests" +] [tool.pytest.ini_options] pythonpath = "src" @@ -88,4 +91,4 @@ exclude_lines = [ ] [tool.ruff.lint.extend-per-file-ignores] -"tests/*" = ["INP001", "ARG"] \ No newline at end of file +"tests/*" = ["INP001", "ARG"] diff --git a/src/shelloracle/bootstrap.py b/src/shelloracle/bootstrap.py index 306208e..f00a430 100644 --- a/src/shelloracle/bootstrap.py +++ b/src/shelloracle/bootstrap.py @@ -134,7 +134,7 @@ def user_configure_settings(provider: type[Provider]) -> dict[str, Any]: for name, setting in get_settings(provider): user_input = prompt(f"{name}: ", default=str(setting.default)) type_ = type(setting.default) if setting.default else str - value = type_(user_input) + value = type_(user_input) # type: ignore[operator] settings[name] = value return settings