cog
dd55693f - fix: stub generation fails locally and produces unformatted output (#2920)

Commit
12 days ago
fix: stub generation fails locally and produces unformatted output (#2920) * fix: set PYTHONHOME for stub_gen to fix local dev with uv-managed Python pyo3-stub-gen's infer_signature feature calls Python::initialize() at runtime. When stub_gen runs outside the Python installation tree (as it does from crates/target/debug/), Py_InitializeEx cannot auto-discover the stdlib and fails with 'No module named encodings'. CI already works around this by using actions/setup-python and setting LD_LIBRARY_PATH. This applies the equivalent fix for local development by setting PYTHONHOME from the venv's base_prefix before running stub_gen. * fix: format generated stubs with ruff to fix stub:check failures pyo3-stub-gen output doesn't match ruff style -- trailing whitespace in docstrings, long lines, single-quote strings. This caused stub:check to fail on main because ruff format (run during CI or locally) would produce a diff against the committed stubs. Two changes: - Add ruff format as a post-step in generate:stubs, using find to catch all .pyi files (bash globstar isn't available on macOS default bash) - Drop sources/outputs caching -- generation takes <1s and the file list was already out of sync (missing _impl.pyi) --------- Co-authored-by: Michael Dwan <mdwan@cloudflare.com>
Author
Parents
Loading