Skip to content

Harden Python codegen formatting#160

Merged
hardbyte merged 1 commit into
mainfrom
brian/python-ruff-format-errors
May 22, 2026
Merged

Harden Python codegen formatting#160
hardbyte merged 1 commit into
mainfrom
brian/python-ruff-format-errors

Conversation

@hardbyte
Copy link
Copy Markdown
Contributor

@hardbyte hardbyte commented May 22, 2026

Summary

  • keep Python codegen's missing-Ruff fallback to basic formatting
  • fail Python codegen when ruff format is found but exits non-zero
  • make --format=false a working escape hatch while preserving bare -f/--format
  • render multi-field Rust tuple structs as Python RootModel[tuple[...]] instead of invalid numeric fields
  • document Ruff as a generated-code formatter dependency for consistent output and pin the Rust CI job to the same Ruff version as the Python smoke test

Validation

  • cargo fmt --check
  • cargo test -p reflectapi-cli
  • cargo test -p reflectapi --lib
  • cargo run -p reflectapi-cli --quiet -- codegen -s reflectapi-demo/reflectapi.json -o /tmp/reflectapi-no-ruff-check-client -l python --python-package-name api_client --python-sync -f with Ruff absent from PATH
  • cargo test -p reflectapi-demo tests::basic::test_reflectapi_struct_tuple -- --nocapture with Ruff on PATH
  • cargo test -p reflectapi-demo test_python_split_modules -- --nocapture with Ruff on PATH
  • cargo test -p reflectapi-demo --test codegen_coverage -- --nocapture with Ruff on PATH
  • cargo test -p reflectapi-demo tests::write_python_client -- --nocapture with Ruff on PATH

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 22, 2026

📖 Documentation Preview: https://reflectapi-docs-preview-pr-160.partly.workers.dev

Updated automatically from commit 635290c

@hardbyte hardbyte force-pushed the brian/python-ruff-format-errors branch 2 times, most recently from 6c9ef0e to 20cf572 Compare May 22, 2026 04:04
@hardbyte hardbyte changed the title Require Ruff when formatting Python codegen Harden Python codegen formatting May 22, 2026
@hardbyte hardbyte force-pushed the brian/python-ruff-format-errors branch from 20cf572 to 496030a Compare May 22, 2026 04:06
Comment thread reflectapi-cli/tests/output_paths.rs
Fail Python codegen when ruff format is requested but Ruff is missing or fails, and make --format=false a working escape hatch. Document Ruff as a formatter dependency and pin the CI Ruff version used by Rust tests.
@hardbyte hardbyte force-pushed the brian/python-ruff-format-errors branch from 496030a to a2c840f Compare May 22, 2026 04:20
@hardbyte hardbyte merged commit b8fef04 into main May 22, 2026
6 checks passed
@hardbyte hardbyte deleted the brian/python-ruff-format-errors branch May 22, 2026 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants