Skip to content

Commit 5518367

Browse files
authored
20200602 type hints part1 (Project-MONAI#477)
* DOC: Type hints support for the Sphinx autodoc extension https://github.com/agronholm/sphinx-autodoc-typehints * setup.cfg to ignore pep484 warnings related to refactoring These temporary changes are needed in order to decouple adding typehints in separate PR's to a completely clean typehint checked system. It is not possible to have small independant commits and exhaustive typehint checking over the entire package. * Add .gitignore for .pyre temporary files.
1 parent 7cd6561 commit 5518367

File tree

3 files changed

+56
-3
lines changed

3 files changed

+56
-3
lines changed

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,14 @@ temp/
110110
.idea/
111111

112112
*~
113+
114+
# Remove .pyre temporary config files
115+
.pyre
116+
.pyre_configuration
117+
118+
# temporary editor files that should not be in git
119+
.orig
120+
.bak
121+
.swp
122+
*~
123+
.DS_Store

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ sphinxcontrib-htmlhelp==1.0.2
1717
sphinxcontrib-jsmath==1.0.1
1818
sphinxcontrib-qthelp==1.0.2
1919
sphinxcontrib-serializinghtml==1.1.3
20+
sphinx-autodoc-typehints>=1.10.3

setup.cfg

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ ignore =
3636
N812
3737
# suppress flake8-mypy failures occuring when MYPYPATH=${src_dir}/monai/monai
3838
T499
39+
# --- Temporary disabling to allow smaller PRs
40+
# Subsequent fixes necessary to make this tool pass are not yet
41+
# merged into the master branch, but requested as separate
42+
# commits. Can not enable until all outstanding typehint
43+
# PR's are approved
44+
T484
45+
# Unused imports may be used later, disable warning while we
46+
# separate many PR's
47+
F401
48+
# ^^^^^^^^^ Temporary disabling to allow smaller PRs
3949
per-file-ignores = __init__.py: F401
4050
exclude = *.pyi,.git,monai/_version.py,versioneer.py
4151

@@ -48,11 +58,27 @@ tag_prefix =
4858
parentdir_prefix =
4959

5060
[mypy]
61+
# --- Temporary disabling to allow smaller PRs
62+
# Subsequent fixes necessary to make this tool pass are not yet
63+
# merged into the master branch, but requested as separate
64+
# commits. Can not enable until all outstanding typehint
65+
# PR's are approved
66+
ignore_errors = True ## Temporarily disable all mypy warnings
67+
# ^^^^^^ Temporary disabling to allow smaller PRs
68+
69+
5170
# do not follow imports (except for ones found in typeshed)
5271
follow_imports=normal
5372

5473
# suppress errors about unsatisfied imports
55-
ignore_missing_imports=False
74+
# The pytorch-ignite package is not type hinted and generates
75+
# hundreds of failures that are not the priority to address
76+
# at the monment. Eventually ignore_missing_imports=False
77+
# should be used add consistent typing information to
78+
# those parts of the MONAI package that depend on ignite.
79+
ignore_missing_imports=True
80+
# Temporarily ignore all site packages too
81+
# --no_site_packages=True
5682

5783
# allow returning Any as a consequence of the options above
5884
warn_return_any=True
@@ -63,10 +89,25 @@ warn_no_return=True
6389
# lint-style cleanliness for typing needs to be disabled; returns more errors
6490
# than the full run.
6591
warn_redundant_casts=True
66-
warn_unused_ignores=True
67-
# NOTE: All relative paths are relative to the location of this file.
92+
warn_unused_ignores=False
93+
94+
[mypy-torch.*]
95+
# --- Temporary disabling to allow smaller PRs
96+
# Subsequent fixes necessary to make this tool pass are not yet
97+
# merged into the master branch, but requested as separate
98+
# commits. Can not enable until all outstanding typehint
99+
# PR's are approved
100+
ignore_errors = True ## Temporarily disable all mypy warnings
101+
# ^^^^^^ Temporary disabling to allow smaller PRs
102+
follow_imports = skip
103+
follow_imports_for_stubs = True
104+
105+
[mypy-monai._version]
106+
# Always ignore any type issues in teh monai/._version file
107+
ignore_errors = True
68108

69109
[pytype]
110+
# NOTE: All relative paths are relative to the location of this file.
70111
# Space-separated list of files or directories to exclude.
71112
exclude = **/*_test.py **/test_*.py
72113
# Space-separated list of files or directories to process.

0 commit comments

Comments
 (0)