Conversation
- add sigmf/keys.py with all core: field key constants and file extension constants - rename 8 abbreviated keys to match their core: string values (e.g. FLO_KEY -> FREQ_LOWER_EDGE_KEY, HASH_KEY -> SHA512_KEY) - export all key constants at sigmf.* module level via from .keys import * - deprecate old names via metaclass __getattr__ with DeprecationWarning - update all internal modules (sigmffile, siggen, archivereader, validate, converters) to reference keys directly - archive.py now imports extension constants from keys instead of defining them - add TestDeprecatedKeyAliases test class - bump version 1.10.0 -> 1.11.0
There was a problem hiding this comment.
Pull request overview
This PR refactors SigMF metadata key constants into a dedicated sigmf.keys module (re-exported at sigmf.*), introduces deprecation warnings for class-level key access, and expands archive support to include compressed SigMF archives plus a new sigmf.tofile() convenience writer.
Changes:
- Add
sigmf.keysas the canonical location for key/extension constants, and deprecateSigMFFile.*_KEY/old alias names with warnings. - Add compressed archive read/write support (
.sigmf.gz,.sigmf.xz,.sigmf.zip) and update archive APIs to accept acompressionargument. - Add
sigmf.tofile()convenience function and update tests/docs to use the new key constants and archive behaviors.
Reviewed changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/testdata.py | Update test fixtures to use module-level key constants. |
| tests/test_validation.py | Update validation tests for renamed key constants. |
| tests/test_sigmffile.py | Add tests for sigmf.tofile() and deprecation behavior; update key usage. |
| tests/test_siggen.py | Update generator tests to use module-level key constants. |
| tests/test_ncd.py | Update NCD tests for renamed hash/index keys. |
| tests/test_hashing.py | Update hashing tests to use SHA512_KEY. |
| tests/test_collection.py | Add sigmf import (currently unused). |
| tests/test_attributes.py | Update attribute-access tests to use module-level key constants. |
| tests/test_archivereader.py | Update archive reader tests for key constant refactor. |
| tests/test_archive.py | Add compressed archive roundtrip/behavior tests and memmap assertion. |
| tests/conftest.py | Add sigmf import for test environment consistency. |
| sigmf/validate.py | Switch validator ordering/extension checks to new key constants. |
| sigmf/sigmffile.py | Core refactor: deprecating key access, key list centralization, archive/tofile API updates, add sigmf.tofile(). |
| sigmf/siggen.py | Update generator metadata/annotation building to use keys.*. |
| sigmf/keys.py | New module defining key constants, valid key lists, archive extensions, and deprecated alias mapping. |
| sigmf/hashing.py | Extend hashing API with offset/size parameters (needs fixes). |
| sigmf/convert/wav.py | Converter updated to use keys.* constants. |
| sigmf/convert/signalhound.py | Converter updated to use keys.* constants. |
| sigmf/convert/blue.py | Converter updated to use keys.* constants. |
| sigmf/archivereader.py | Add zip + compressed tar support; add memmap path for uncompressed tar. |
| sigmf/archive.py | Add compressed archive writing + zip support; add extension/compression resolution helpers. |
| sigmf/init.py | Export keys at module level; bump version; export tofile. |
| docs/source/quickstart.rst | Document sigmf.tofile() and update frequency-edge key names. |
| docs/source/advanced.rst | Update docs for renamed keys and add compressed archive documentation. |
| README.md | Document reading compressed archives and writing with sigmf.tofile(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| self.sigmffile.dump(handle) | ||
| if isinstance(self.sigmffile.data_buffer, io.BytesIO): | ||
| # write data buffer to archive | ||
| self.sigmffile.data_file = data_path |
There was a problem hiding this comment.
This mutates the caller’s SigMFFile (self.sigmffile.data_file = data_path) when archiving from an in-memory buffer, but the temp directory is removed at the end of __init__. That leaves the original object pointing at a non-existent data_file. Avoid mutating the passed-in object (use a local variable or restore the original data_file).
| self.sigmffile.data_file = data_path |
|
@777arc I think this is ready now, but you can ask copilot to look again. I haven't used the automated reviews before. |
|
Yeah I guess I'll kick the AI review off one more time just to make sure there are no huge bugs or anything, then it can merge. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 23 out of 23 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Looks ready to me. |
Going to stick AI on it