Introduce static type checking into the API
MyPy is a terrific project that lets us introduce static typing into parts of our code. Since there are certain parts of the code which follow a specific type, use MyPy to type check those portions.
MyPy: http://mypy-lang.org/
- [x] Identify parts of the code that can be type checked (all private functions)
- [x] Add static typing to them
Hi, I'd like to pick up this issue. I'll look at #74 as an example.
As a next step, I would recommend using tox to wrap up testing, type checking, and linting into one simple, portable command: tox !
Awesome! Thanks @Jdsleppy. And tox is something I'm looking at, but we're waiting on a PR to be completed to make the tests hermetic first.
I opened a PR to type annotate about half of the code base. I see somebody worked on this in the meantime, so there were pretty nasty merge conflicts and duplication of work. I still think my changes are valuable because they tend to specify the types a little further in places where Any is used. Also, it adds annotations to library.py.
There is also a bugfix for a test in the PR.
https://github.com/Pitt-CSC/PittAPI/pull/82
I'm reopening this issue because I don't think it was ever actually completed:
- There are some parts of the code that still aren't type-hinted
- mypy was never added to the repo's tooling
- Now that we're using pre-commit, we can easily introduce and (and more importantly enforce) static type checking