From 28b90edbdf933362b314bf6fca97db281a934111 Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Sun, 15 Oct 2023 16:16:15 -0700 Subject: [PATCH 1/6] ENH: add mypy config --- pyproject.toml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index c2f479fe5c..cabc53738a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -108,6 +108,31 @@ Source = "https://github.com/nebari-dev/nebari" [project.scripts] nebari = "nebari.__main__:main" +[tool.mypy] +python_version = "3.8" +warn_return_any = true +warn_unused_configs = true +exclude = [ + "src/_nebari/stages/kubernetes_services/template" # skip traitlets configuration files +] + +[[tool.mypy.overrides]] +module = [ + "auth0.authentication", + "auth0.management", + "CloudFlare", + "kubernetes", + "kubernetes.client", + "kubernetes.config", + "kubernetes.client.rest", + "kubernetes.client.exceptions", + "keycloak", + "keycloak.exceptions", + "boto3", + "botocore.exceptions", +] +ignore_missing_imports = true + [tool.ruff] select = [ "E", From 9142ebb0de40a6df822f217ea716a9b4f0869331 Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Wed, 18 Oct 2023 12:00:24 -0700 Subject: [PATCH 2/6] add workflow --- .github/workflows/typing.yaml | 49 +++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/typing.yaml diff --git a/.github/workflows/typing.yaml b/.github/workflows/typing.yaml new file mode 100644 index 0000000000..8fffe1e20b --- /dev/null +++ b/.github/workflows/typing.yaml @@ -0,0 +1,49 @@ +name: "Typing Check" + +on: + pull_request: + paths: + - ".github/workflows/typing.yaml" + - "tests/**" + - "scripts/**" + - "src/**" + - "pyproject.toml" + push: + branches: + - main + - develop + - release/\d{4}.\d{1,2}.\d{1,2} + paths: + - ".github/workflows/typing.yaml" + - "tests/**" + - "scripts/**" + - "src/**" + - "pyproject.toml" + +jobs: + typing-check: + runs-on: ubuntu-latest + continue-on-error: true + concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + steps: + - name: "Checkout Repository" + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + cache: "pip" + + - name: Install Nebari + run: | + python --version + pip install -e .[dev] + + - name: Run MyPy + run: | + mypy --install-types From 30cc2cb89f801194ea1cc6262b90709e094dbf14 Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Wed, 18 Oct 2023 12:03:19 -0700 Subject: [PATCH 3/6] add mypy to dependencies --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index db7249add0..90b54fbfe2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -78,6 +78,7 @@ dependencies = [ [project.optional-dependencies] dev = [ "black==22.3.0", + "mypy==1.6.1", "dask-gateway", "diagrams", "python-dotenv", From 8699258d7fd68a4a476b2b2f4be2126657ed6f2a Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Wed, 18 Oct 2023 12:10:19 -0700 Subject: [PATCH 4/6] fix config --- .github/workflows/typing.yaml | 2 +- pyproject.toml | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/typing.yaml b/.github/workflows/typing.yaml index 8fffe1e20b..19c0e87b04 100644 --- a/.github/workflows/typing.yaml +++ b/.github/workflows/typing.yaml @@ -23,7 +23,6 @@ on: jobs: typing-check: runs-on: ubuntu-latest - continue-on-error: true concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true @@ -45,5 +44,6 @@ jobs: pip install -e .[dev] - name: Run MyPy + continue-on-error: true run: | mypy --install-types diff --git a/pyproject.toml b/pyproject.toml index 90b54fbfe2..089b262a52 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -108,9 +108,12 @@ Source = "https://github.com/nebari-dev/nebari" nebari = "nebari.__main__:main" [tool.mypy] -python_version = "3.8" warn_return_any = true warn_unused_configs = true +files = [ + "src/_nebari", + "src/nebari", +] exclude = [ "src/_nebari/stages/kubernetes_services/template" # skip traitlets configuration files ] From 5c4c268538e8431d1d2f6393d66b98ce8392cc02 Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Wed, 18 Oct 2023 12:45:40 -0700 Subject: [PATCH 5/6] update config --- .github/workflows/typing.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/typing.yaml b/.github/workflows/typing.yaml index 19c0e87b04..c5d8251343 100644 --- a/.github/workflows/typing.yaml +++ b/.github/workflows/typing.yaml @@ -4,8 +4,6 @@ on: pull_request: paths: - ".github/workflows/typing.yaml" - - "tests/**" - - "scripts/**" - "src/**" - "pyproject.toml" push: @@ -15,8 +13,6 @@ on: - release/\d{4}.\d{1,2}.\d{1,2} paths: - ".github/workflows/typing.yaml" - - "tests/**" - - "scripts/**" - "src/**" - "pyproject.toml" @@ -46,4 +42,4 @@ jobs: - name: Run MyPy continue-on-error: true run: | - mypy --install-types + mypy --install-types --non-interactive From 9a530969b8da0f6dd8f06d2696e64b552ec2152d Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Wed, 18 Oct 2023 14:26:02 -0700 Subject: [PATCH 6/6] fix pre-commit, install type stubs --- .github/workflows/typing.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/typing.yaml b/.github/workflows/typing.yaml index c5d8251343..ae3fa18b93 100644 --- a/.github/workflows/typing.yaml +++ b/.github/workflows/typing.yaml @@ -34,12 +34,13 @@ jobs: python-version: "3.11" cache: "pip" - - name: Install Nebari + - name: Install Nebari and type stubs run: | python --version pip install -e .[dev] + pip install types-Pygments types-requests types-six - name: Run MyPy continue-on-error: true run: | - mypy --install-types --non-interactive + mypy