diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 3593d7e7..da2454b7 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,8 +1,3 @@ - - # Checklist - [ ] Added a `CHANGELOG.rst` entry diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1c3ec0b1..e3c02b66 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,15 +27,35 @@ jobs: fetch-depth: 0 - name: Run pre-commit-conda uses: quantco/pre-commit-conda@v1 + mypy-type-checks: + name: Mypy Type Checks + runs-on: ubuntu-latest + steps: + - name: Checkout branch + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + fetch-depth: 0 + - name: Set up Conda env + uses: mamba-org/setup-micromamba@422500192359a097648154e8db4e39bdb6c6eed7 + with: + condarc-file: .github/assets/.condarc + environment-file: environment.yml + cache-environment: true + - name: Install repository + run: python -m pip install --no-build-isolation --no-deps --disable-pip-version-check -e . + - name: Run mypy + run: mypy . - linux-unittests: - name: "Unit tests - Python ${{ matrix.PYTHON_VERSION }}" + unit-tests: + name: Unit Tests - ${{ matrix.os == 'ubuntu-latest-8core' && 'Linux' || 'Windows' }} - Python ${{ matrix.python-version }} timeout-minutes: 30 - runs-on: ubuntu-latest-8core + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - PYTHON_VERSION: ["3.10", "3.11", "3.12"] + os: [ubuntu-latest-8core] + python-version: ["3.10", "3.11", "3.12"] steps: - name: Checkout branch uses: actions/checkout@v4 @@ -49,7 +69,7 @@ jobs: environment-file: environment.yml cache-environment: true create-args: >- - python=${{ matrix.PYTHON_VERSION }} + python=${{ matrix.python-version }} pytest-md pytest-emoji - name: Install repository @@ -57,7 +77,7 @@ jobs: - name: Run unittests uses: quantco/pytest-action@v2 with: - report-title: "Unit tests Linux - Python ${{ matrix.PYTHON_VERSION }}" + report-title: Unit Tests - ${{ matrix.os == 'ubuntu-latest' && 'Linux' || 'Windows' }} - Python ${{ matrix.python-version }} custom-arguments: --cov=metalearners --cov-report=xml --cov-report term-missing --color=yes - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4.3.1 diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml deleted file mode 100644 index a1905e5a..00000000 --- a/.github/workflows/mypy.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Type check -on: [push] - -concurrency: - group: "${{ github.workflow }}-${{ github.ref }}" - cancel-in-progress: true - -defaults: - run: - shell: "bash -el {0}" - -env: - QUETZ_API_KEY: "${{ secrets.QUETZ_API_KEY }}" - -jobs: - mypy: - name: Run Mypy - runs-on: ubuntu-latest - steps: - - name: Checkout branch - uses: actions/checkout@v4 - with: - ref: "${{ github.head_ref }}" - fetch-depth: 0 - - name: Set up Conda env - uses: mamba-org/setup-micromamba@422500192359a097648154e8db4e39bdb6c6eed7 - with: - condarc-file: .github/assets/.condarc - environment-file: environment.yml - cache-environment: true - - name: Install repository - run: >- - python -m pip install --no-build-isolation --no-deps - --disable-pip-version-check -e . - - name: Run mypy - run: mypy . diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7a518499..9b4c0930 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,11 +14,11 @@ repos: hooks: - id: docformatter-conda - repo: https://github.com/Quantco/pre-commit-mirrors-ruff - rev: 0.3.4 + rev: 0.4.2 hooks: - id: ruff-conda - repo: https://github.com/Quantco/pre-commit-mirrors-black - rev: 24.3.0 + rev: 24.4.2 hooks: - id: black-conda - repo: https://github.com/Quantco/pre-commit-mirrors-mypy @@ -32,13 +32,13 @@ repos: - id: prettier-conda files: \.(md|yml|yaml)$ - repo: https://github.com/Quantco/pre-commit-mirrors-pre-commit-hooks - rev: 4.5.0 + rev: 4.6.0 hooks: - id: trailing-whitespace-conda - id: end-of-file-fixer-conda - id: check-merge-conflict-conda args: ["--assume-in-merge"] - repo: https://github.com/Quantco/pre-commit-mirrors-typos - rev: 1.19.0 + rev: 1.20.10 hooks: - id: typos-conda diff --git a/environment.yml b/environment.yml index e8af3b32..846ff180 100644 --- a/environment.yml +++ b/environment.yml @@ -11,16 +11,17 @@ dependencies: - pip - python>=3.10 - setuptools-scm - - mypy=1.9.0 - - setuptools>=61 # Adds support for pyproject.toml package declaration. - ## Documentation + - setuptools >=61 # Adds support for pyproject.toml package declaration. + # Documentation - make - numpydoc - sphinx - sphinxcontrib-apidoc - sphinx_rtd_theme - ## Testing - - pytest>=6 # Adds --import-mode option + # Development + - mypy =1.9.0 + # Testing + - pytest >=6 # Adds --import-mode option - pytest-cov ## Numerical # First version to add the return_indices parameter to cross_validate. diff --git a/pyproject.toml b/pyproject.toml index e78faef4..5239969d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,6 +45,7 @@ exclude = ''' [tool.ruff] line-length = 88 + [tool.ruff.lint] ignore = [ "N803", # https://docs.astral.sh/ruff/rules/invalid-argument-name @@ -79,4 +80,4 @@ testpaths = [ ] [tool.typos.default] -extend-ignore-re = ["HTE", "crace"] +extend-ignore-re = ["HTE", "crace", "(?Rm)^.*#\\s*spellchecker:disable-line$"] diff --git a/tests/conftest.py b/tests/conftest.py index 828c6534..133543ab 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -62,7 +62,7 @@ def mindset_data(): categorical_feature_columns = [ "ethnicity", "gender", - "frst_in_family", + "frst_in_family", # spellchecker:disable-line "school_urbanicity", "schoolid", ]