Skip to content

Add pyright to tests #5048

Closed
Closed

Description

@srittau

I propose to add pyright to our CI test suite. pyright is a stable type checker and probably the fastest to implement new typing features. Also:

  • pyright is frequently used as it is the standard type checker for the popular Visual Studio Code IDE/editor.
  • pyright has many useful warnings, not found in other type checkers.
  • Not running pyright as part of our CI complicates the job for pyright's maintainers as evidenced by the frequent clean-up PRs by Eric Traut. This will be even more of an issue when pyright decides not to ship third-party stubs.

I think the discussion in #5035 shows that adding pyright to CI is uncontroversial. Cc'ing @JelleZijlstra @hauntsaninja and @erictraut.

Activity

  1. changed the title [-]Add pylance to tests[/-] [+]Add pyrigh to tests[/+] on Feb 22, 2021
  2. changed the title [-]Add pyrigh to tests[/-] [+]Add pyright to tests[/+] on Feb 22, 2021
  3. srittau commented on Feb 22, 2021

    @srittau
    CollaboratorAuthor

    (And of course by "pylance" I meant "pyright". Corrected it above.)

  4. erictraut commented on Feb 22, 2021

    @erictraut
    Contributor

    I think this is a great idea. If there are no objections, we (the pyright contributors) will work on a PR that incorporates the command-line version of pyright into a CI test for typeshed. We'll let you know if we need help with any of the specifics.

  5. srittau commented on Feb 22, 2021

    @srittau
    CollaboratorAuthor

    @erictraut FWIW I have taken a stab at a general framework for this in #5051. I'd be glad if your team takes over, and you can use elements from that PR as you feel appropriate. The main thing I'd like to see is that it keeps the general idea of having a tests/pyright_test.py script to run the tests. The test should also support a tests/pyright_exclude_list.text file, like the other type checkers do.

  6. erictraut commented on Feb 22, 2021

    @erictraut
    Contributor

    That's a great start. Thanks!

    Pyright uses a configuration file called "pyrightconfig.json" to control which diagnostic rules are enabled, which directories should be included/excluded, etc. This config file is expected to be at the root directory of the project. Would it be OK if we added this file at the root of typeshed and used that instead of a text-based exclude list? If that isn't acceptable, we could auto-generate the pyrightconfig.json file as part of the test script.

  7. srittau commented on Feb 22, 2021

    @srittau
    CollaboratorAuthor

    Pyright uses a configuration file called "pyrightconfig.json" to control which diagnostic rules are enabled, which directories should be included/excluded, etc. This config file is expected to be at the root directory of the project. Would it be OK if we added this file at the root of typeshed and used that instead of a text-based exclude list? If that isn't acceptable, we could auto-generate the pyrightconfig.json file as part of the test script.

    Sounds fine to me.

  8. srittau commented on Feb 23, 2021

    @srittau
    CollaboratorAuthor

    A small additional thought: tests/pyright_exclude_list.txt could contain a small note pointing to pyrightconfig.json so people unfamiliar with pyright know where to look.

  9. jakebailey commented on Feb 23, 2021

    @jakebailey
    Contributor

    I opened #5059 which is based on #5051 with the PR comments addressed, and will update it with a more finalized config.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    project: policyOrganization of the typeshed project

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions