| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
This pull request commits engine schema files to git. If we decide against it, I have an alternative PR for this change: #34 |
Sorry, something went wrong.
There was a problem hiding this comment.
I'm not sure. We'll either have to keep the dynamic typing or unify static types for all repositories.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
This PR adds Python type stub files so editors and type checker tools can better understand valid SerpApi search parameters and return types. Type stubs are metadata for developer tooling only: they improve autocomplete and static analysis, but they are not loaded by the client at runtime and do not add runtime validation.
Changes
Files Added
serpapi/*.pyi
Generated type stub files that describe the public API, search arguments, overloads, and return types for type checkers and editors.
serpapi/py.typed
PEP 561 marker file that tells type checkers the installed serpapi package includes typing information.
typing/build-engines.py
Helper script that fetches supported SerpApi engine parameters from the SerpApi playground and writes local engine schema JSON files.
typing/generate_type_stubs.py
Generator script that converts the local engine schema JSON files into Python .pyi type stubs.
typing/engines/*.json
Local engine schema inputs. These are committed, so stub generation is deterministic, and CI check python typing/generate_type_stubs.py --check uses these engine schema to validate .pyi stubs
tests/test_build_typing.py
Tests for the stub generator, including syntax validation, stale/corruption prevention, output path defaults, and return-type overload behavior.
Reference Links
Before / After
Before
After
type_hints.mp4With this update, IDEs and type-checking extensions can identify invalid parameters and show warnings. (Note: these are just IDE warnings; the code will run without errors and the request will be sent to SerpApi beacuse Python is not strict with type enforcements).
Notes