Skip to content

Commit

Permalink
Add stubdefaulter to create_baseline_stubs.py (#10127)
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam authored May 2, 2023
1 parent bbeec7c commit 1caac91
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions requirements-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pre-commit-hooks==4.4.0 # must match .pre-commit-confi
pycln==2.1.3 # must match .pre-commit-config.yaml
pytype==2023.4.27; platform_system != "Windows" and python_version < "3.11"
pyyaml==6.0
stubdefaulter==0.1.0
termcolor>=2.3
tomli==2.0.1
tomlkit==0.11.8
Expand Down
8 changes: 7 additions & 1 deletion scripts/create_baseline_stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,19 @@ def run_stubgen(package: str, output: str) -> None:
subprocess.run(["stubgen", "-o", output, "-p", package, "--export-less"], check=True)


def run_stubdefaulter(stub_dir: str) -> None:
print(f"Running stubdefaulter: stubdefaulter --packages {stub_dir}")
subprocess.run(["stubdefaulter", "--packages", stub_dir])


def run_black(stub_dir: str) -> None:
print(f"Running black: black {stub_dir}")
subprocess.run(["black", stub_dir])


def run_isort(stub_dir: str) -> None:
print(f"Running isort: isort {stub_dir}")
subprocess.run(["python3", "-m", "isort", stub_dir])
subprocess.run([sys.executable, "-m", "isort", stub_dir])


def create_metadata(stub_dir: str, version: str) -> None:
Expand Down Expand Up @@ -152,6 +157,7 @@ def main() -> None:
sys.exit(f"Error: {package_dir} already exists (delete it first)")

run_stubgen(package, stub_dir)
run_stubdefaulter(stub_dir)

run_isort(stub_dir)
run_black(stub_dir)
Expand Down

0 comments on commit 1caac91

Please sign in to comment.