Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
8c6c7ac
Script to run all checks locally
Avasam Sep 27, 2022
da2191e
missing return types
Avasam Sep 27, 2022
e3d293f
Apply suggestions from code review
Avasam Sep 27, 2022
9a0757c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 27, 2022
850d7fa
summary
Avasam Sep 27, 2022
9f92d0f
Merge branch 'run-all-checks-single-script' of https://github.com/Ava…
Avasam Sep 27, 2022
60f3f86
skip pyright if no npx
Avasam Sep 27, 2022
6b0544d
mypy type ignore
Avasam Sep 27, 2022
dc9d4eb
"Skipping" message
Avasam Sep 27, 2022
0241da0
mypy false positive
Avasam Sep 27, 2022
6ad47a3
rename
Avasam Sep 27, 2022
994173a
explicit CompletedProcess type because mypy
Avasam Sep 27, 2022
69c8bd8
Merge branch 'master' into run-all-checks-single-script
AlexWaygood Sep 28, 2022
36aaf68
mention in readme
Avasam Sep 28, 2022
80bc8c7
Apply suggestions from code review
Avasam Sep 28, 2022
430f855
Merge branch 'run-all-checks-single-script' of https://github.com/Ava…
Avasam Sep 28, 2022
169ad68
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 28, 2022
7aa69d3
annotations
Avasam Sep 28, 2022
901a4ad
Merge branch 'run-all-checks-single-script' of https://github.com/Ava…
Avasam Sep 28, 2022
f02191e
obsolete comment
Avasam Sep 28, 2022
31a3c10
PR comments
Avasam Sep 29, 2022
22b6cc9
Merge branch 'master' of https://github.com/python/typeshed into run-…
Avasam Sep 29, 2022
4ff0c8d
Merge branch 'master' of https://github.com/python/typeshed into run-…
Avasam Oct 1, 2022
77a3c9b
Set python version and better output
Avasam Oct 1, 2022
e8e1c43
Typed main
Avasam Oct 1, 2022
024e696
mention venv bug
Avasam Oct 2, 2022
3ceb0d3
output update
Avasam Oct 2, 2022
f9f3154
revert debug change
Avasam Oct 2, 2022
fad18bf
Update tests/README.md
Avasam Oct 2, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
  • Loading branch information
Avasam and AlexWaygood authored Sep 27, 2022
commit e3d293fa85f89d07e8ce217b754f13268f5f0d03
6 changes: 2 additions & 4 deletions scripts/create_baseline_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,8 @@ def main() -> None:

print("\nDone!\n\nSuggested next steps:")
print(f" 1. Manually review the generated stubs in {stub_dir}")
print(" 2. See CONTRIBUTING.md for all the best practices and tips to improve your stub")
print(' 3. Run autofixes and tests locally using "python3 -m ./scripts/run_all_checks.py"')
print(" See tests/README.md to run individual tests")
print(" 4. Commit the changes on a new branch and create a typeshed PR (don't force-push!)")
print(" 2. Optionally run tests and autofixes (see tests/README.md for details")
Comment thread
AlexWaygood marked this conversation as resolved.
print(" 3. Commit the changes on a new branch and create a typeshed PR (don't force-push!)")


if __name__ == "__main__":
Expand Down
14 changes: 8 additions & 6 deletions scripts/run_all_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@


def _parse_jsonc(json_text: str) -> str:
parsed_json_text = re.sub(r"^\s*?//.*?\n", "", json_text, flags=re.RegexFlag.MULTILINE)
parsed_json_text = re.sub(r",([\n\s]*?[\}\]])", r"\1", parsed_json_text)
return parsed_json_text
# strip comments from the file
lines = [line for line in text.split('\n') if not line.strip().startswith('//')]
# strip trailing commas from the file
valid_json = re.sub(r",(\s*?[\}\]])", r"\1", "\n".join(lines))
return valid_json


def _get_strict_params(stub_path: str) -> list[str]:
Expand All @@ -29,21 +31,21 @@ def _get_strict_params(stub_path: str) -> list[str]:
except IndexError:
print("Missing path argument in format <folder>/<stub>")
sys.exit(1)
path_tokens = path.replace("\\", "/").split("/")
path_tokens = Path(path).parts
assert len(path_tokens) == 2, "Path argument should be in format <folder>/<stub>"
folder, stub = path_tokens
assert folder in {"stdlib", "stubs"}, "Only the 'stdlib' and 'stubs' folders are supported"

subprocess.run(["python3", "-m", "black", path])
subprocess.run(["python3", "-m", "pycln", path, "--all"])
subprocess.run(["python3", "-m", "isort", path])
subprocess.run(["python3", "-m", "black", path])
subprocess.run(["python3", "-m", "flake8", path, "--extend-ignore", _extend_ignore])

subprocess.run(["python3", "tests/check_consistent.py"])
subprocess.run(["python3", "tests/check_new_syntax.py"])

subprocess.run(["python3", "tests/pyright_test.py", path] + _get_strict_params(path))
Comment thread
AlexWaygood marked this conversation as resolved.
Outdated

# FIXME: Fails to see requires
mypy_result = subprocess.run(["python3", "tests/mypy_test.py", path])

# TODO: Run in WSL if available
Comment thread
AlexWaygood marked this conversation as resolved.
Outdated
Expand Down