Commit fb2072c9 authored by Gao, Xiang's avatar Gao, Xiang Committed by Farhad Ramezanghorbani
Browse files

Enable mypy static typing check (#365)

* add mypy

* update

* fix

* only core

* add badge

* try
parent 004f5a52
name: mypy
on:
pull_request:
push:
branches:
- master
schedule:
- cron: '0 0 * * *'
jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Type checking with mypy
run: |
pip install --upgrade pip
pip install mypy
mypy --no-site-packages --ignore-missing-imports torchani/{aev,nn,utils,models,ase}.py
...@@ -9,6 +9,7 @@ Checks: ...@@ -9,6 +9,7 @@ Checks:
[![Actions Status](https://github.com/aiqm/torchani/workflows/docs/badge.svg)](https://github.com/aiqm/torchani/actions) [![Actions Status](https://github.com/aiqm/torchani/workflows/docs/badge.svg)](https://github.com/aiqm/torchani/actions)
[![Actions Status](https://github.com/aiqm/torchani/workflows/flake8/badge.svg)](https://github.com/aiqm/torchani/actions) [![Actions Status](https://github.com/aiqm/torchani/workflows/flake8/badge.svg)](https://github.com/aiqm/torchani/actions)
[![Actions Status](https://github.com/aiqm/torchani/workflows/mypy/badge.svg)](https://github.com/aiqm/torchani/actions)
[![Actions Status](https://github.com/aiqm/torchani/workflows/runnable%20submodules/badge.svg)](https://github.com/aiqm/torchani/actions) [![Actions Status](https://github.com/aiqm/torchani/workflows/runnable%20submodules/badge.svg)](https://github.com/aiqm/torchani/actions)
[![Actions Status](https://github.com/aiqm/torchani/workflows/tools/badge.svg)](https://github.com/aiqm/torchani/actions) [![Actions Status](https://github.com/aiqm/torchani/workflows/tools/badge.svg)](https://github.com/aiqm/torchani/actions)
[![Actions Status](https://github.com/aiqm/torchani/workflows/unit%20tests/badge.svg)](https://github.com/aiqm/torchani/actions) [![Actions Status](https://github.com/aiqm/torchani/workflows/unit%20tests/badge.svg)](https://github.com/aiqm/torchani/actions)
......
...@@ -2,10 +2,10 @@ import numpy as np ...@@ -2,10 +2,10 @@ import numpy as np
import torch import torch
import functools import functools
from ._pyanitools import anidataloader from ._pyanitools import anidataloader
import importlib from importlib import util as u
import gc import gc
PKBAR_INSTALLED = importlib.util.find_spec('pkbar') is not None PKBAR_INSTALLED = u.find_spec('pkbar') is not None
if PKBAR_INSTALLED: if PKBAR_INSTALLED:
import pkbar import pkbar
......
...@@ -29,9 +29,9 @@ if __name__ == '__main__': ...@@ -29,9 +29,9 @@ if __name__ == '__main__':
parser.add_argument('--checkpoint_name', parser.add_argument('--checkpoint_name',
help='Name of checkpoint file', help='Name of checkpoint file',
default='model.pt') default='model.pt')
parser = parser.parse_args() args = parser.parse_args()
d = torch.device(parser.device) d = torch.device(args.device)
trainer = Trainer(parser.config_path, d, parser.tqdm, parser.tensorboard, parser.checkpoint_name) trainer = Trainer(args.config_path, d, args.tqdm, args.tensorboard, args.checkpoint_name)
trainer.load_data(parser.training_path, parser.validation_path) trainer.load_data(args.training_path, args.validation_path)
trainer.run() trainer.run()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment