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

Fix mypy 0.800 plus when prepending $PYTHONPATH to sys.path #5698

Merged
merged 6 commits into from
Feb 1, 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
2 changes: 1 addition & 1 deletion .github/workflows/code-formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
python-version: 3.8
- name: Install mypy
run: |
pip install mypy
pip install mypy==0.790
pip list
- name: mypy check
run: |
Expand Down
1 change: 1 addition & 0 deletions tests/models/data/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# this is needed only for mypy==0.800 as it undestands only packages
1 change: 1 addition & 0 deletions tests/models/data/horovod/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# this is needed only for mypy==0.800 as it undestands only packages
6 changes: 4 additions & 2 deletions tests/models/data/horovod/train_default_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
import os
import sys

# this is need as e.g. Conda do not uses `PYTHONPATH` env var as pip or/and virtualenv
sys.path = os.getenv('PYTHONPATH').split(':') + sys.path
# this is needed because Conda does not use `PYTHONPATH` env var while pip and virtualenv do
PYTHONPATH = os.getenv('PYTHONPATH', '')
if ':' in PYTHONPATH:
sys.path = PYTHONPATH.split(':') + sys.path

from pytorch_lightning import Trainer # noqa: E402
from pytorch_lightning.callbacks import ModelCheckpoint # noqa: E402
Expand Down
Empty file.