Skip to content
This repository was archived by the owner on Oct 2, 2021. It is now read-only.

Find an alternative to Pyre #85

@dirn

Description

@dirn

When we switched to Django in #22, we switched from mypy to Pyre. The main
reason was that the latter included stubs for Django, whereas the former
requires an additional plugin which requires executing the code;
this is problematic because of how our settings are structured.

Pyre's stubs seem to suffer from some breakage between releases (as noted by the
CI logs for #78). While looking into one of the errors, I discovered a URL while
reading a comment about an import in a stub file that points to Facebook's
internal Phabricator. It's pretty clear that this is Facebook's source of truth
for Pyre. I'd rather use an open source tool that is developed in the public.

There are a few options for what to use. We can go back to mypy. We'll still
have the problem of getting stubs for Django. mypy-django is a project that
provides stubs but isn't installable; using it would require cloning the
repository as part of the tox environment.
(mypy-django hasn't been
updated since 2017.)

Another option would be to use pyright. This is written in TypeScript. I'm not
sure how that would work with tox. It seems to support generating type stubs
for libraries that don't have them which could be useful.

The final option that I know of is pytype. Unlike mypy, pytype infers types
from your code instead of using gradual typing. It's also more lenient and
allows any operations that would succeed at runtime. I prefer mypy's approach.

Metadata

Metadata

Assignees

No one assigned

    Labels

    request for commentsFeedback is requested before work on this issue can proceed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions