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

Introduce static type checking into the API #45

Open
2 tasks done
RitwikGupta opened this issue Feb 13, 2017 · 4 comments
Open
2 tasks done

Introduce static type checking into the API #45

RitwikGupta opened this issue Feb 13, 2017 · 4 comments

Comments

@RitwikGupta
Copy link
Member

RitwikGupta commented Feb 13, 2017

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/

  • Identify parts of the code that can be type checked (all private functions)
  • Add static typing to them
@Jdsleppy
Copy link
Contributor

Jdsleppy commented Oct 5, 2017

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 !

@RitwikGupta
Copy link
Member Author

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.

@Jdsleppy Jdsleppy mentioned this issue Oct 5, 2017
@Jdsleppy
Copy link
Contributor

Jdsleppy commented Oct 5, 2017

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.

#82

@tianyizheng02
Copy link
Contributor

I'm reopening this issue because I don't think it was ever actually completed:

  1. There are some parts of the code that still aren't type-hinted
  2. mypy was never added to the repo's tooling
  3. Now that we're using pre-commit, we can easily introduce and (and more importantly enforce) static type checking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants