Don't overwrite identical wrappers#82
Merged
Merged
Conversation
Closed
Contributor
There was a problem hiding this comment.
Pull request overview
Implements incremental wrapper generation by avoiding rewrites when regenerated wrapper content is identical, reducing downstream rebuilds, and adds a CLI escape hatch to force rewrites when needed (supports #74). The PR also modernizes packaging/CI by moving project metadata into pyproject.toml, adding unit-test CI, and adjusting declared Python support.
Changes:
- Add
write_file_if_changed()and thread anoverwriteflag through generator/writers; expose it via--overwrite. - Update wrapper writers to skip writing unchanged wrapper files by default (preserving mtimes).
- Migrate packaging metadata from
setup.cfg/setup.pytopyproject.toml, add unit tests + unit-test workflow, and update docs/CI configuration accordingly.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
tests/test_utils.py |
Adds unit tests for “write only if changed” behavior and overwrite forcing. |
setup.py |
Removes legacy setuptools entrypoint (packaging migrated to pyproject.toml). |
setup.cfg |
Removes legacy package metadata/config (packaging migrated to pyproject.toml). |
README.md |
Documents the new --overwrite behavior and incremental rewrite default. |
pyproject.toml |
Adds PEP 621 project metadata / extras, updates build backend, and changes declared Python requirement. |
examples/cells/pyproject.toml |
Updates example package’s declared Python requirement. |
examples/cells/conda/variants/python3.9.yaml |
Removes Python 3.9 conda variant. |
examples/cells/conda/variants/python3.8.yaml |
Removes Python 3.8 conda variant. |
cppwg/writers/package_writer.py |
Threads overwrite setting from package writer into module writers. |
cppwg/writers/module_writer.py |
Uses write_file_if_changed() for module wrapper output and propagates overwrite into class writer. |
cppwg/writers/header_collection_writer.py |
Uses write_file_if_changed() for header collection output. |
cppwg/writers/class_writer.py |
Uses write_file_if_changed() for per-class .hpp/.cpp outputs. |
cppwg/utils/utils.py |
Introduces write_file_if_changed() helper used by writers. |
cppwg/generators.py |
Adds overwrite option to generator and passes it through to writers. |
cppwg/__main__.py |
Adds --overwrite CLI flag and forwards it to the generator. |
.github/workflows/test-unit.yml |
Adds a unit-test workflow running pytest. |
.github/workflows/test-style.yml |
Expands workflow triggers to run on develop pushes. |
.github/workflows/test-shapes-pip.yml |
Expands workflow triggers to run on develop pushes. |
.github/workflows/test-cells-ubuntu.yml |
Expands workflow triggers to run on develop pushes. |
.github/workflows/test-cells-conda.yml |
Expands workflow triggers to run on develop pushes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supports #74