Skip to content

Commit

Permalink
Type gha (facebookresearch#28)
Browse files Browse the repository at this point in the history
Summary:
- Run mypy on all files on PRs. I tried doing it for files changes by PR but then it starts looking at the config files also :(
- Add some ignores based on iopath changes

Pull Request resolved: facebookresearch#28

Test Plan:
- made a typing error in cnn_lstm -> type checkinng workflow fails https://github.com/facebookresearch/multimodal/runs/6068075411?check_suite_focus=true
- Fixed the error -> workflow passes on this PR https://github.com/facebookresearch/multimodal/runs/6068955875?check_suite_focus=true

Reviewed By: langong347

Differential Revision: D35730759

Pulled By: ankitade

fbshipit-source-id: bc23c824bd91753c24e13a44e19c45d183481b1e
  • Loading branch information
ankitade authored and facebook-github-bot committed Apr 19, 2022
1 parent 7cfef46 commit 56e3b59
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
25 changes: 24 additions & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: "3.8"

- name: Check out repos
uses: actions/checkout@v2
with:
Expand All @@ -26,3 +25,27 @@ jobs:
output: ' '
- name: Lint modified files
run: pre-commit run --files ${{ steps.file_changes.outputs.files }}
type_checking:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Setup conda env
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
activate-environment: test
python-version: "3.8"
- name: Install dependencies
shell: bash -l {0}
run: |
set -eux
conda activate test
conda install pytorch torchvision torchtext cpuonly -c pytorch-nightly
pip install -e ".[dev]"
- name: Type check all files
shell: bash -l {0}
run: |
set -eux
conda activate test
mypy --install-types --non-interactive --config-file mypy.ini
6 changes: 6 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,9 @@ ignore_missing_imports = True

[mypy-torchvision.*]
ignore_missing_imports = True

[mypy-torchmultimodal.fb.*]
ignore_missing_imports = True

[mypy-iopath.*]
ignore_missing_imports = True
1 change: 0 additions & 1 deletion torchmultimodal/modules/losses/flava.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.


import math
import warnings
from dataclasses import dataclass, field
Expand Down

0 comments on commit 56e3b59

Please sign in to comment.