Skip to content

Commit ea636a3

Browse files
committed
MyPy: Switch to package-discovery, instead of file-discovery
This switches to using MyPy's package-discovery mechanism, having it enumerate and then type-check everything within and under `stanford.mais`. (`stanford.mais` is used instead of `stanford` in case anything else starts using that namespace.) This is better than listing a directory to check, because it ensures that all modules have been discovered, and their relationships laid out. Unfortunately, although it's possible to provide a list of files/directories in config, you can't do this with modules/packages. I've requested support for this in python/mypy#10728
1 parent 456690a commit ea636a3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
python -m pip install .[test]
4646
- name: Run MyPy
4747
run: |
48-
mypy
48+
mypy --package stanford.mais
4949
5050
publish-test:
5151
name: Publish pushes to PyPi's test instance

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ build-backend = "setuptools.build_meta"
1313
namespace_packages = true
1414
pretty = true
1515
no_color_output = true
16-
files = [
16+
mypy_path = [
1717
"src"
1818
]
19+
# There is no support for putting `-p` / `-package` in the MyPy config file.
20+
# Feature requested: https://github.com/python/mypy/issues/10728
1921

2022
[tool.pytest.ini_options]
2123
testpaths = [

0 commit comments

Comments
 (0)