-
Notifications
You must be signed in to change notification settings - Fork 2
Version 3.1.0: Various changes and improvements #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces version 3.1.0 with several enhancements and improvements to the packtype library. The main additions include a new variants feature for conditional compilation, a copy utility function for packtype instances, a diff utility for comparing packtype objects, and improved string representations with tree-style formatting. Additional improvements include better test coverage, documentation updates, and bug fixes.
Key changes:
- Added variants feature to support conditional definitions in packtype grammar
- Implemented utility functions for copying and comparing packtype instances
- Enhanced string representation with tree-style formatting for nested structures
- Added normative points support for marking priority levels
Reviewed Changes
Copilot reviewed 46 out of 46 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| vscode/packtype/syntaxes/packtype.tmLanguage.json | Added syntax highlighting for variants and default keywords |
| tests/utils/test_utils_basic.py | Added comprehensive tests for new diff, diff_table, copy utilities and enhanced get_width tests |
| tests/svg/test_struct_svg.py | Updated to use sys.executable instead of hardcoded python3 |
| tests/pysyntax/test_union.py | Updated test assertions to match new tree-style string formatting |
| tests/pysyntax/test_struct.py | Updated test assertions and added test for max_depth parameter in tree printing |
| tests/pysyntax/test_array.py | Added tests for array comparison and string representation |
| tests/integration/test_sv.py | Updated to use sys.executable instead of hardcoded python3 |
| tests/grammar/test_variant.py | Added comprehensive tests for the new variants feature |
| tests/grammar/test_union.py | Added test for copying union instances |
| tests/grammar/test_struct.py | Added test for copying struct instances |
| tests/grammar/test_scalar.py | Added test for copying scalar instances |
| tests/grammar/test_normative.py | Added tests for the new normative points feature |
| tests/grammar/test_enum.py | Added test for copying enum instances |
| tests/grammar/test_descriptions.py | Fixed import statement formatting |
| pyproject.toml | Updated version to 3.1.0 and added tabulate dependency |
| packtype/utils/union.py | Refactored normalization function with improved documentation and type checking |
| packtype/utils/struct.py | Refactored normalization function with improved documentation and type checking |
| packtype/utils/package.py | Added get_all_types utility and fixed ScalarType import |
| packtype/utils/enum.py | Added is_enum utility and improved normalization function |
| packtype/utils/basic.py | Added copy, diff, and diff_table utilities; enhanced get_name for arrays |
| packtype/utils/init.py | Exported new utility functions |
| packtype/types/package.py | Added support for normative points and refactored filtering methods |
| packtype/types/normative.py | Added new NormativePoint class for priority marking |
| packtype/types/bitvector.py | Fixed typo and optimized window width computation |
| packtype/types/base.py | Added copy and deepcopy guards to enforce using utils.copy |
| packtype/types/assembly.py | Refactored string representation to use tree-style formatting with depth control |
| packtype/types/array.py | Made PackedArray inherit from Numeric and added string representation |
| packtype/start.py | Added variant support to CLI commands and updated type hints |
| packtype/grammar/transformer.py | Added variant transformation logic and TransformerError class |
| packtype/grammar/packtype.lark | Added grammar rules for variants and normative points |
| packtype/grammar/grammar.py | Added variant flattening logic in parse functions |
| packtype/grammar/examples/package_b.pt | Removed example file |
| packtype/grammar/examples/package_a.pt | Removed example file |
| packtype/grammar/declarations.py | Added variant and normative declaration classes |
| mkdocs.yml | Added variants documentation to navigation |
| examples/variants/test.sh | Added test script for variants example |
| examples/variants/spec.pt | Added variants example specification |
| docs/syntax/variants.md | Added comprehensive variants documentation |
| docs/syntax/union.md | Updated package naming in examples from MyPackage to ThePackage |
| docs/syntax/struct.md | Updated package naming in examples from MyPackage to ThePackage |
| docs/syntax/scalar.md | Updated package naming in examples from MyPackage to ThePackage |
| docs/syntax/package.md | Updated package naming in examples from MyPackage to ThePackage |
| docs/syntax/instance.md | Updated package naming in examples from MyPackage to ThePackage |
| docs/syntax/enum.md | Updated package naming in examples from MyPackage to ThePackage |
| docs/syntax/docstrings.md | Updated package naming in examples from MyPackage to ThePackage |
| docs/syntax/constant.md | Updated package naming in examples from MyPackage to ThePackage |
Comments suppressed due to low confidence (2)
tests/pysyntax/test_struct.py:1
- This assertion compares struct_a_copy to itself instead of checking all three values. Should be
assert struct_a == struct_a_copy == struct_a_equals.
# Copyright 2023-2025, Peter Birch, mailto:[email protected]
tests/pysyntax/test_union.py:1
- This assertion compares union_a_copy to itself instead of checking all three values. Should be
assert union_a == union_a_copy == union_a_equals.
# Copyright 2023-2025, Peter Birch, mailto:[email protected]
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
OisinRobinson
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes look good to me.
This PR introduces a number of changes and improvements to the library from real-world use:
.ptfiles) updates:variantskeyword, which can be used for feature-flagging or allowing different activities to lag the bleeding edge;Numericwhich allows it to be used in comparisons, it also gains a__str__method to allow it to be printed with ease;BitVectorwhich yield a small performance improvement;