Improve JMP17 writer and reader support - #2
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
There are a couple of confirmed correctness/robustness issues in the writer (non-string column labels and long variable-width string lengths) plus a portability issue in the new example script.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates jmpio to better match JMP 17.2.0’s on-disk format, improving writer header/metadata emission and expanding reader handling for additional markers and string encodings, with corresponding new/extended tests and a JMP JSL repro script.
Changes:
- Update writer to emit a JMP 17.2.0-style header/preamble and column metadata/offset table layout.
- Extend reader parsing for additional column-info markers and string/index decoding edge cases.
- Expand test coverage for JMP17 writer structure and additional reader fixtures.
File summaries
| File | Description |
|---|---|
| tests/test_writer.py | Adds JMP17 writer assertions (metadata, structure records) and adjusts round-trip comparisons. |
| tests/test_reader.py | Adds fixture coverage for compact subtype variants, marker handling, and fixed-width string null padding behavior. |
| src/jmpio/writer.py | Implements JMP 17.2.0-only writer path with new header/preamble, metadata records, offset table writing, and improved dtype handling. |
| src/jmpio/metadata.py | Extends column-info scanning to skip an additional marker type (0xfc 0xff). |
| src/jmpio/column.py | Fixes/extends decoding for row states, fixed-width strings with null padding, pooled string index widths, and adds an Int64 row state branch. |
| examples/create_bogus_data.jsl | Adds a JSL script to generate a native JMP 17 table for debugging/fixtures. |
Review details
- Files reviewed: 6/13 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+591
to
+595
| use_int16 = max_length >= 128 | ||
|
|
||
| # Prepare header | ||
| header = bytearray([0] * 13) | ||
| header[9] = 2 if use_int16 else 1 # Width bytes | ||
| header[8] = 2 if use_int16 else 1 # Width bytes |
| @@ -174,49 +230,25 @@ def write_column_metadata(file: BinaryIO, df: pd.DataFrame) -> list[int]: | |||
| width = min(max(len(column_name) * 8, 40), 300) | |||
| @@ -0,0 +1,43 @@ | |||
| Names Default To Here( 1 ); | |||
|
|
|||
| out = "C:/GitHub/jmpio-python/examples/bogus_data_jmp17_native.jmp"; | |||
Comment on lines
+175
to
+176
| build_string = b"Jul 23 2023, 19:09:15, Release, JMP, Version 17.2.0" | ||
| build_end = data.index(build_string) + len(build_string) |
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.
No description provided.