8000 Single script to run PR checks locally · Issue #8686 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content
Single script to run PR checks locally #8686
Closed
@Avasam

Description

@Avasam

After running scripts/create_baseline_stubs.py, we are informed of the following

Suggested next steps:
1. Manually review the generated stubs in {stub_dir}
2. Run "MYPYPATH={stub_dir} python3 -m mypy.stubtest {package}" to check the stubs against runtime
3. Run "mypy {stub_dir}" to check for errors
4. Run "black {stub_dir}" and "isort {stub_dir}" (if you\'ve made code changes)
5. Run "flake8 {stub_dir}" to check for e.g. unused imports
6. Commit the changes on a new branch and create a typeshed PR

There's a few issues with running those commands as such:

  1. Setting the MYPYPATH environment variable and running a script afterward is done differently per shell (think of powershell for example, where its $Env:MYPYPATH="{stub_dir}"; python3 -m mypy.stubtest {package})
  2. These will ignore some configurations such as METADATA.toml, stubtest_allowlist.txt, etc.
  3. Does not include other checks defined in https://github.com/python/typeshed/blob/master/tests/README.md
  4. It takes multiple commands to autofix and check everything
  5. Overall, the results will be different from what's on the CI

For those reasons, I suggest adding a new script under scripts that a dev who's contributing to typeshed can run locally to easily and completely check their stubs. The documentation in CONTRIBUTING.md and the output of scripts/create_baseline_stubs.py should then be updated accordingly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    project: infrastructuretypeshed build, test, documentation, or distribution related

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0