diff --git a/.github/workflows/typing.yaml b/.github/workflows/typing.yaml new file mode 100644 index 000000000..ae3fa18b9 --- /dev/null +++ b/.github/workflows/typing.yaml @@ -0,0 +1,46 @@ +name: "Typing Check" + +on: + pull_request: + paths: + - ".github/workflows/typing.yaml" + - "src/**" + - "pyproject.toml" + push: + branches: + - main + - develop + - release/\d{4}.\d{1,2}.\d{1,2} + paths: + - ".github/workflows/typing.yaml" + - "src/**" + - "pyproject.toml" + +jobs: + typing-check: + runs-on: ubuntu-latest + 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 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 diff --git a/pyproject.toml b/pyproject.toml index 63f0835cb..089b262a5 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", @@ -106,6 +107,34 @@ Source = "https://github.com/nebari-dev/nebari" [project.scripts] nebari = "nebari.__main__:main" +[tool.mypy] +warn_return_any = true +warn_unused_configs = true +files = [ + "src/_nebari", + "src/nebari", +] +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",