Skip to content

feat(python): typed exceptions, Reader protocol, and bridge fix#178

Draft
cpsievert wants to merge 4 commits intofeat/vegalite-render-chartfrom
feat/python-exceptions-protocol
Draft

feat(python): typed exceptions, Reader protocol, and bridge fix#178
cpsievert wants to merge 4 commits intofeat/vegalite-render-chartfrom
feat/python-exceptions-protocol

Conversation

@cpsievert
Copy link
Collaborator

@cpsievert cpsievert commented Mar 9, 2026

Depends on #177 (merge that first)

Summary

  • Add typed exception classes (ParseError, ValidationError, ReaderError, WriterError) subclassing ValueError for backwards compatibility
  • Add Reader protocol class defining the contract for custom readers (execute_sql, register)
  • Fix PyReaderBridge to pass replace as a keyword argument, so custom readers with register(name, df, *, replace=False) signatures work correctly

Rust changes

  • create_exception! macros for 4 exception types + ggsql_err_to_py() mapper
  • All .map_err(...) sites updated from generic PyValueError to typed exceptions
  • PyReaderBridge.register() uses call_method with kwargs instead of call_method1

cpsievert and others added 3 commits March 9, 2026 16:43
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…r, ReaderError, WriterError)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…onsistency

The Reader protocol defines replace as a keyword parameter. Make the
bridge path match so custom readers aren't required to accept it
positionally. Update test custom readers accordingly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant