| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
This PR adds generated static typing stub files (.pyi) for the serpapi package, plus helper scripts under typing/ to regenerate those stubs from SerpApi engine metadata, and packaging/CI updates so the stubs are distributed with releases.
Changes:
Copilot reviewed 7 out of 10 changed files in this pull request and generated 10 comments.
Show a summary per file| File | Description |
|---|---|
| typing/generate_type_stubs.py | New generator that builds .pyi stubs from engine JSON metadata. |
| typing/build-engines.py | New script that fetches SerpApi playground metadata and writes engine JSON files locally. |
| tests/test_build_typing.py | Tests for stub generation helpers (syntax validation, output structure). |
| serpapi/py.typed | PEP 561 marker for distributing typing information. |
| serpapi/init.pyi | Generated top-level stub exports for the package API. |
| pyproject.toml | Adds typing_extensions runtime dep; adds dev extra; configures package data for .pyi/py.typed. |
| MANIFEST.in | Ensures stub files are included in source distributions. |
| .github/workflows/release.yml | Adds a --check step intended to verify generated typing files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
| import tempfile | ||
| from dataclasses import dataclass | ||
| from pathlib import Path | ||
| from typing import Any, Iterable |
| return unique | ||
|
|
||
|
|
||
| def literal_type(values: list[Any]) -> str | None: |
| return f"{prefix}JsonSearchParams", f"{prefix}HtmlSearchParams" | ||
|
|
||
|
|
||
| def format_typed_dict(engine: Engine, *, class_name: str, output: Param | None = None) -> list[str]: |
|
|
||
| def format_search_overload( | ||
| *, | ||
| receiver: str | None, |
|
|
||
| def format_params_dict_overload( | ||
| *, | ||
| receiver: str | None, |
| return lines | ||
|
|
||
|
|
||
| def format_params_dict_overloads(*, receiver: str | None, engine: Engine) -> list[str]: |
| return lines | ||
|
|
||
|
|
||
| def format_search_overloads(engines: list[Engine], *, receiver: str | None) -> list[str]: |
| return parser.parse_args(argv) | ||
|
|
||
|
|
||
| def main(argv: list[str] | None = None) -> int: |
| - name: Build sdist and wheel | ||
| run: | | ||
| pip install build | ||
| python typing/generate_type_stubs.py --check | ||
| python -m build |
| [project.optional-dependencies] | ||
| color = ["pygments"] | ||
| test = ["pytest"] | ||
| dev = ["markdownify"] |
| Back | FazBrowse Home | New Git URL |
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.