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:
- 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})
- These will ignore some configurations such as
METADATA.toml, stubtest_allowlist.txt, etc.
- Does not include other checks defined in https://github.com/python/typeshed/blob/master/tests/README.md
- It takes multiple commands to autofix and check everything
- 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.
After running
scripts/create_baseline_stubs.py, we are informed of the followingThere's a few issues with running those commands as such:
MYPYPATHenvironment 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})METADATA.toml,stubtest_allowlist.txt, etc.For those reasons, I suggest adding a new script under
scriptsthat 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 ofscripts/create_baseline_stubs.pyshould then be updated accordingly.