Skip to content

Commit

Permalink
Add typechecking and action to typecheck and test
Browse files Browse the repository at this point in the history
This will help set the stage for the refactoring!
  • Loading branch information
mfisher87 committed Aug 14, 2024
1 parent 07c0d90 commit 1c02968
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Test

on:
pull_request:
branches:
- v2 # TODO: Remove!
- development
- main
push:
branches:
- main
- development


jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.12"]

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Install package and test dependencies
run: |
# TODO: Once we have expressed dependencies in a more standard way:
# python -m pip install .[test]
python -m pip install .
python -m pip install -r requirements-dev.txt
- name: Type-check package
run: mypy

- name: Unit test
# TODO: Test behind EDL
run: pytest icepyx/ --verbose --cov app --ignore=icepyx/tests/test_behind_NSIDC_API_login.py --ignore=icepyx/tests/test_auth.py

- name: Upload coverage report
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
39 changes: 39 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ version_file = "_icepyx_version.py"
version_file_template = 'version = "{version}"'
local_scheme = "node-and-date"
fallback_version = "unknown"


# [tool.ruff.format]
# docstring-code-format = true
# docstring-code-line-length = "dynamic"
Expand Down Expand Up @@ -98,3 +100,40 @@ ignore = [

# Ignore too many leading '#' for block comment
"*/tests/*" = ["E266"]


[tool.mypy]
files = "icepyx/."
mypy_path = ["icepyx"]
# TODO: Enable ASAP:
check_untyped_defs = false
# TODO: Then enable:
disallow_untyped_defs = false
disallow_incomplete_defs = false
# TODO: Finally enable (and delete settings above; strict includes them):
strict = false

[[tool.mypy.overrides]]
# Help us adopt mypy by skipping some modules entirely
# GOAL: Remove this whole section!
module = [
"icepyx.core.read",
"icepyx.core.query",
"icepyx.core.visualization",
"icepyx.quest.dataset_scripts.argo",
"icepyx.tests.test_Earthdata",
]
ignore_errors = true

[[tool.mypy.overrides]]
module = [
"dask.*",
"datashader.*",
"h5py.*",
"holoviews.*",
"geopandas.*",
"geoviews.*",
"pypistats.*",
"shapely.*",
]
ignore_missing_imports = true
5 changes: 5 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,8 @@ pypistats
pytest>=4.6
pytest-cov
responses
mypy
pandas-stubs
types-docutils
types-requests
types-tqdm

0 comments on commit 1c02968

Please sign in to comment.