Skip to content

Feature/key simplification#150

Open
777arc wants to merge 10 commits intomainfrom
feature/key-simplification
Open

Feature/key simplification#150
777arc wants to merge 10 commits intomainfrom
feature/key-simplification

Conversation

@777arc
Copy link
Copy Markdown
Member

@777arc 777arc commented Apr 29, 2026

Going to stick AI on it

Teque5 added 5 commits April 24, 2026 20:51
- 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
@777arc 777arc marked this pull request as ready for review April 29, 2026 22:16
@777arc 777arc marked this pull request as draft April 29, 2026 22:16
Copy link
Copy Markdown

Copilot AI left a 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 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.keys as the canonical location for key/extension constants, and deprecate SigMFFile.*_KEY/old alias names with warnings.
  • Add compressed archive read/write support (.sigmf.gz, .sigmf.xz, .sigmf.zip) and update archive APIs to accept a compression argument.
  • 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.

Comment thread sigmf/archivereader.py
Comment thread sigmf/archivereader.py
Comment thread tests/test_collection.py Outdated
Comment thread sigmf/archive.py Outdated
self.sigmffile.dump(handle)
if isinstance(self.sigmffile.data_buffer, io.BytesIO):
# write data buffer to archive
self.sigmffile.data_file = data_path
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
self.sigmffile.data_file = data_path

Copilot uses AI. Check for mistakes.
Comment thread docs/source/quickstart.rst Outdated
Comment thread docs/source/advanced.rst Outdated
Comment thread sigmf/hashing.py
Comment thread sigmf/sigmffile.py Outdated
@Teque5 Teque5 marked this pull request as ready for review May 1, 2026 19:50
@Teque5
Copy link
Copy Markdown
Collaborator

Teque5 commented May 1, 2026

@777arc I think this is ready now, but you can ask copilot to look again. I haven't used the automated reviews before.

@777arc
Copy link
Copy Markdown
Member Author

777arc commented May 1, 2026

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread docs/source/quickstart.rst
Comment thread tests/test_collection.py
Comment thread sigmf/archive.py
Comment thread sigmf/sigmffile.py
Comment thread sigmf/sigmffile.py
@Teque5 Teque5 self-assigned this May 2, 2026
@Teque5
Copy link
Copy Markdown
Collaborator

Teque5 commented May 2, 2026

Looks ready to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants