Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mypy and typing_copilot checks to the CI pipeline. #1528

Merged
merged 5 commits into from
Mar 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .azure-pipelines/azure-pipelines-external.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ jobs:
python -m black --check arviz examples asv_benchmarks
displayName: 'black'

- script: |
python -m mypy .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it help with anything/is it possible to run mypy only on main arviz and example folders?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, not at the moment. typing_copilot doesn't yet have the capability to run mypy with custom flags, so even if you made this command different, the typing_copilot step would still essentially run mypy . and still fail.

Hoping to fix this in a future version of typing_copilot since this is obviously going to be painful for many use cases.

displayName: 'mypy'

- script: |
python -m typing_copilot.cli tighten --error-if-can-tighten
displayName: 'typing_copilot'

- script: |
pytest arviz/tests/helpers.py
displayName: 'precompile models'
Expand Down
285 changes: 285 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,285 @@

# Autogenerated by typing_copilot v0.5.4
[mypy]
no_implicit_optional = True
strict_optional = True
warn_redundant_casts = True
check_untyped_defs = True
disallow_untyped_calls = True
disallow_incomplete_defs = True
disallow_untyped_defs = True
disallow_untyped_decorators = True
ignore_missing_imports = False
warn_unused_ignores = True


# First party per-module rule relaxations
[mypy-arviz.*]
disallow_untyped_calls = False
disallow_untyped_defs = False

[mypy-arviz.data.datasets.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.data.inference_data.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.data.io_cmdstan.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.data.io_cmdstanpy.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.data.io_dict.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.data.io_emcee.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.data.io_json.*]
check_untyped_defs = False

[mypy-arviz.data.io_numpyro.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.data.io_pyjags.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.data.io_pymc3.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.data.io_pyro.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.data.io_pystan.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.data.io_tfp.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.labels.*]
disallow_incomplete_defs = False

[mypy-arviz.plots.backends.*]
check_untyped_defs = False

[mypy-arviz.plots.backends.bokeh.*]
disallow_incomplete_defs = False

[mypy-arviz.plots.backends.matplotlib.forestplot.*]
disallow_incomplete_defs = False

[mypy-arviz.plots.backends.matplotlib.posteriorplot.*]
disallow_incomplete_defs = False

[mypy-arviz.plots.backends.matplotlib.ppcplot.*]
disallow_incomplete_defs = False

[mypy-arviz.plots.densityplot.*]
check_untyped_defs = False

[mypy-arviz.plots.elpdplot.*]
check_untyped_defs = False

[mypy-arviz.plots.pairplot.*]
disallow_incomplete_defs = False

[mypy-arviz.plots.separationplot.*]
check_untyped_defs = False

[mypy-arviz.plots.traceplot.*]
disallow_incomplete_defs = False

[mypy-arviz.rcparams.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.sel_utils.*]
check_untyped_defs = False

[mypy-arviz.stats.density_utils.*]
check_untyped_defs = False

[mypy-arviz.stats.diagnostics.*]
check_untyped_defs = False

[mypy-arviz.stats.stats.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.stats.stats_utils.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.tests.base_tests.test_data.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.tests.base_tests.test_diagnostics.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.tests.base_tests.test_diagnostics_numba.*]
disallow_incomplete_defs = False

[mypy-arviz.tests.base_tests.test_plot_utils.*]
disallow_incomplete_defs = False

[mypy-arviz.tests.base_tests.test_plots_bokeh.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.tests.base_tests.test_plots_matplotlib.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.tests.base_tests.test_rcparams.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.tests.base_tests.test_stats.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.tests.base_tests.test_stats_numba.*]
disallow_incomplete_defs = False

[mypy-arviz.tests.base_tests.test_stats_utils.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.tests.base_tests.test_utils.*]
disallow_incomplete_defs = False

[mypy-arviz.tests.base_tests.test_utils_numba.*]
disallow_incomplete_defs = False

[mypy-arviz.tests.conftest.*]
disallow_incomplete_defs = False

[mypy-arviz.tests.external_tests.test_data_cmdstan.*]
disallow_incomplete_defs = False

[mypy-arviz.tests.external_tests.test_data_cmdstanpy.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.tests.external_tests.test_data_emcee.*]
disallow_incomplete_defs = False

[mypy-arviz.tests.external_tests.test_data_numpyro.*]
disallow_incomplete_defs = False

[mypy-arviz.tests.external_tests.test_data_pyjags.*]
disallow_incomplete_defs = False

[mypy-arviz.tests.external_tests.test_data_pymc.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.tests.external_tests.test_data_pyro.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.tests.external_tests.test_data_pystan.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.tests.helpers.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-arviz.utils.*]
check_untyped_defs = False
disallow_incomplete_defs = False

[mypy-setup.*]
disallow_incomplete_defs = False
disallow_untyped_calls = False
disallow_untyped_defs = False


# Third-party module rule relaxations
[mypy-IPython.*]
ignore_missing_imports = True

[mypy-aesara.*]
ignore_missing_imports = True

[mypy-bokeh.*]
ignore_missing_imports = True

[mypy-cmdstanpy.*]
ignore_missing_imports = True

[mypy-emcee.*]
ignore_missing_imports = True

[mypy-jax.*]
ignore_missing_imports = True

[mypy-matplotlib.*]
ignore_missing_imports = True

[mypy-mpl_toolkits.axes_grid1.*]
ignore_missing_imports = True

[mypy-netCDF4.*]
ignore_missing_imports = True

[mypy-numba.*]
ignore_missing_imports = True

[mypy-numpy.*]
ignore_missing_imports = True

[mypy-numpyro.*]
ignore_missing_imports = True

[mypy-pandas.*]
ignore_missing_imports = True

[mypy-pyjags.*]
ignore_missing_imports = True

[mypy-pymc3.*]
ignore_missing_imports = True

[mypy-pyro.*]
ignore_missing_imports = True

[mypy-pystan.*]
ignore_missing_imports = True

[mypy-scipy.*]
ignore_missing_imports = True

[mypy-setuptools.*]
ignore_missing_imports = True

[mypy-stan.*]
ignore_missing_imports = True

[mypy-tensorflow.*]
ignore_missing_imports = True

[mypy-tensorflow_probability.*]
ignore_missing_imports = True

[mypy-theano.*]
ignore_missing_imports = True

[mypy-zarr.*]
ignore_missing_imports = True
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ pylint
pytest
pytest-cov
black ; python_version >= '3.6'
typing_copilot ; python_version >= '3.7'
mypy<0.800