From 00c261f951ae6734001e0419d2bc754eef6dd1b2 Mon Sep 17 00:00:00 2001 From: Ross Barnowski Date: Wed, 17 Nov 2021 21:12:56 -0800 Subject: Add Mypy type checking infrastructure (#5127) * Add minimal mypy configuration file. * Add mypy workflow to GH. * Properly import sentinels from traversal.edgedfs. * mypy doesn't like variables named \"e\". * Rm annotations from single function. * Fix name collisions in test suite. Make sure all tests have unique names. * Rm unused random seed in test setup. * Rm redundant __all__ specification. * Silence mypy error from sum(). Mypy bug? * Fix tsp test instantiation nit. * \"type: ignore\" to suppress conditional fn sigature errors. * Remaining \"type: ignore\" to appease mypy. * Configure mypy to ignore inheritance issues. * Update exclude conf for CI. - Add yaml - Reformat regex containing reportviews * Rm partial annotations from lukes.py. Fixes mypy errors due to unannotated code. * Reorg defaultdict to reduce type: ignore cruft. * Homogenize signatures for fns defined in conditionals. * err as varname only in exception catching. * Fix name collision in Bellman-Ford test suite. --- .github/workflows/mypy.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/mypy.yml (limited to '.github') diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml new file mode 100644 index 00000000..4fb47ba8 --- /dev/null +++ b/.github/workflows/mypy.yml @@ -0,0 +1,30 @@ +name: Mypy + +on: [push, pull_request] + +jobs: + type-check: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.9] + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install packages + run: | + pip install --upgrade pip wheel setuptools + pip install -r requirements/developer.txt + # Rm below when yaml no longer a dep + pip install types-PyYAML + pip install -e . + pip list + + - name: run mypy + run: mypy -p networkx -- cgit v1.2.1