-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix some pyright member access errors in training module (#2121)
* Fix pyright member access errors in training module * Fix Trainer instantiation error due to inheritence order * Add GH workflow for pyright * Fix more pyright errors in trainer module * Add pyrightconfig and setup python environment in type-check workflow * Exclude pyrightconfig.json * suggestions Co-authored-by: Jirka <jirka@pytorchlightning.ai>
- Loading branch information
Showing
18 changed files
with
192 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: "Python static type checking" | ||
on: | ||
# Trigger the workflow on push or pull request, | ||
# but only for the master branch | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
python_type_checking: | ||
name: Python static type checking with Pyright | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-18.04] | ||
python-version: [3.7] | ||
|
||
# Timeout: https://stackoverflow.com/a/59076067/4521646 | ||
timeout-minutes: 15 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
# Note: This uses an internal pip API and may not always work | ||
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow | ||
- name: Get pip cache | ||
id: pip-cache | ||
run: | | ||
python -c "from pip._internal.locations import USER_CACHE_DIR; print('::set-output name=dir::' + USER_CACHE_DIR)" | ||
- name: Cache pip | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.pip-cache.outputs.dir }} | ||
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-extra.txt') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ matrix.python-version }}-pip- | ||
- name: Install dependencies | ||
run: | | ||
# python -m pip install --upgrade --user pip | ||
pip install -r requirements.txt -U -f https://download.pytorch.org/whl/torch_stable.html -q | ||
HOROVOD_BUILD_ARCH_FLAGS="-mfma" pip install -r ./tests/requirements-devel.txt -q | ||
# pip install tox coverage | ||
python --version | ||
pip --version | ||
pip list | ||
shell: bash | ||
|
||
- name: Set up node | ||
uses: actions/setup-node@v1 | ||
|
||
- name: Install pyright | ||
run: | | ||
npm install pyright | ||
- name: Run type checking | ||
run: | | ||
$(npm bin)/pyright --project .pyrightconfig.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"include": [ | ||
"pytorch_lightning" | ||
], | ||
|
||
"ignore": [ | ||
"pytorch_lightning/__init__.py", | ||
"pytorch_lightning/callbacks", | ||
"pytorch_lightning/core", | ||
"pytorch_lightning/loggers", | ||
"pytorch_lightning/logging", | ||
"pytorch_lightning/metrics", | ||
"pytorch_lightning/overrides", | ||
"pytorch_lightning/profiler", | ||
"pytorch_lightning/pt_overrides", | ||
"pytorch_lightning/root_module", | ||
"pytorch_lightning/utilities", | ||
"pytorch_lightning/trainer/data_loading.py", | ||
"pytorch_lightning/trainer/deprecated_api.py", | ||
"pytorch_lightning/trainer/distrib_parts.py", | ||
"pytorch_lightning/trainer/evaluation_loop.py", | ||
"pytorch_lightning/trainer/logging.py", | ||
"pytorch_lightning/trainer/lr_finder.py", | ||
"pytorch_lightning/trainer/optimizers.py", | ||
"pytorch_lightning/trainer/supporters.py", | ||
"pytorch_lightning/trainer/trainer.py", | ||
"pytorch_lightning/trainer/training_io.py", | ||
"pytorch_lightning/trainer/training_loop.py", | ||
"pytorch_lightning/trainer/training_tricks.py" | ||
], | ||
|
||
"reportMissingImports": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.