Skip to content

Commit c09e156

Browse files
authored
Better typing (#394)
* Add py.typed and mypy CI * Add py.typed and mypy CI Remove mypy from pre-commit * remove CI trigger * fix syntax * Add path * Add lxml * Add to env file so its cached * Move to pyproject.toml * Small fixes * [WIP] * str -> Hashable * Remove deprecated functions * [WIP] * Almost there. * Done! * fix test. * More fixes * Silence renaming warning * Fix tests * Silence pytest warnings * Add tests with tuple, fix curvefit * Fix rename_like * More fixes
1 parent 3407d29 commit c09e156

File tree

12 files changed

+306
-271
lines changed

12 files changed

+306
-271
lines changed

.github/workflows/ci.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,41 @@ jobs:
122122
shell: bash -l {0}
123123
run: |
124124
pytest -n 2
125+
126+
mypy:
127+
name: mypy
128+
runs-on: "ubuntu-latest"
129+
defaults:
130+
run:
131+
shell: bash -l {0}
132+
env:
133+
PYTHON_VERSION: "3.10"
134+
steps:
135+
- uses: actions/checkout@v3
136+
with:
137+
fetch-depth: 0 # Fetch all history for all branches and tags.
138+
- name: Set up conda environment
139+
uses: mamba-org/provision-with-micromamba@v14
140+
with:
141+
environment-file: ci/environment.yml
142+
environment-name: cf_xarray_test
143+
cache-env: true
144+
extra-specs: |
145+
python="${{ env.PYTHON_VERSION }}"
146+
- name: Install cf_xarray
147+
run: |
148+
python -m pip install --no-deps -e .
149+
- name: Install mypy
150+
run: |
151+
python -m pip install 'mypy'
152+
- name: Run mypy
153+
run: |
154+
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report cf_xarray/
155+
- name: Upload mypy coverage to Codecov
156+
uses: codecov/[email protected]
157+
with:
158+
file: mypy_report/cobertura.xml
159+
flags: mypy
160+
env_vars: PYTHON_VERSION
161+
name: codecov-umbrella
162+
fail_ci_if_error: false

.pre-commit-config.yaml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ repos:
1818
hooks:
1919
- id: flake8
2020

21-
- repo: https://github.com/pre-commit/mirrors-mypy
22-
rev: v0.991
23-
hooks:
24-
- id: mypy
25-
additional_dependencies: [types-all]
26-
2721
- repo: https://github.com/rstcheck/rstcheck
2822
rev: v6.1.1
2923
hooks:

0 commit comments

Comments
 (0)