Skip to content

Commit

Permalink
Add static type checking using mypy (Adversarial-Deep-Learning#86)
Browse files Browse the repository at this point in the history
Co-authored-by: Somesh Kumar Singh <f20180175@goa.bits-pilani.ac.in>
  • Loading branch information
Devanshu24 and someshsingh22 authored Oct 11, 2021
1 parent 0257efa commit 191a0a9
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Static Typing

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
typing:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.8]

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 dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Enforce typing
run: |
mypy --config-file mypy.ini
30 changes: 30 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[mypy]
files = code_soup
pretty = True
show_error_codes = True

check_untyped_defs = True
disallow_incomplete_defs = True
disallow_subclassing_any = True
disallow_untyped_decorators = True
disallow_untyped_defs = True
no_implicit_optional = True
strict_equality = True
warn_redundant_casts = True
warn_unused_configs = True
warn_unused_ignores = True

[mypy-numpy.*]
ignore_missing_imports = True

[mypy-torchvision.*]
ignore_missing_imports = True

[mypy-scipy.*]
ignore_missing_imports = True

[mypy-cv2.*]
ignore_missing_imports = True

[mypy-PIL.*]
ignore_missing_imports = True
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ torchvision==0.10.0
parameterized==0.8.1
scipy==1.6.2
opencv-python==4.5.3.56
mypy==0.910

0 comments on commit 191a0a9

Please sign in to comment.