Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the excelize-py FFI surface to support Excel data validations and adds several StreamWriter features aimed at reducing Python↔Go call overhead (batch row writes, bulk column styling), plus a new in-memory serialization API.
Changes:
- Added DataValidation types/helpers and new
add_data_validation()/get_data_validations()bindings. - Added StreamWriter enhancements:
set_rows()batch write,set_col_style()/set_col_styles()column styling, andCellsupport for styled/formula streaming. - Added
File.write_to_buffer()for in-memory workbook serialization and bumped version to 0.0.9.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
types_py.py |
Adds DataValidation enums/helpers and a Cell dataclass for styled streaming. |
types_go.py |
Extends ctypes structs for Interface (StyleID/Formula) and adds result structs for new APIs. |
types_c.h |
Extends C ABI structs for Interface, DataValidation, and bytes-return result. |
main.go |
Implements new exported FFI functions (data validation, streaming batch/style, write-to-buffer) and updated interface conversion. |
excelize.py |
Adds Python-facing APIs for new FFI functions plus performance-focused conversions for streaming. |
test_excelize.py |
Adds tests for new StreamWriter/data validation features and adjusts VBA project test path. |
setup.py |
Bumps package version to 0.0.9. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…iter-performance-add-data-validation-methods
- Revert changes for functions: py_value_to_c_interface and get_data_validations - Add example documentation for add_data_validation - Simplify code - Update unit tests - Upgrade GitHub Action packages version
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #43 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 4 4
Lines 3713 3907 +194
==========================================
+ Hits 3713 3907 +194
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
xuri
left a comment
There was a problem hiding this comment.
Thanks for your contribution. I made some changes based on your branch.
Add data validation functionality to excelize-py along with significant StreamWriter performance improvements and new features.
New Data Validation Support
DataValidationclass with helper methods for setting validation typesDataValidationTypeenum (whole, decimal, list, date, time, textLength, custom)DataValidationOperatorenum (between, equal, greaterThan, lessThan, etc.)DataValidationErrorStyleenum (stop, warning, information)add_data_validation()- apply validation rules to cell rangesget_data_validations()- retrieve all validations from a worksheetStreamWriter Performance Optimizations
set_rows()batch method - Write multiple rows in a single FFI callctypesassignment - Eliminateddataclassreflection overheadstart_colparameter - Flexible column positioning forset_rows()set_col_style()method - Efficient bulk column styling during streamingCell Class for Styled Streaming
In-Memory Serialization
File.write_to_buffer()- Serialize workbook to bytes without disk I/OTest plan
add_data_validationwith all validation typesget_data_validationsretrieves existing validationsset_rowsperformance with large datasets (300K+ rows)write_to_buffermatchessave_asperformance