Repository navigation
Read and write GEDZIP archives - #17
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Archive-entry name collisions can replace dataset or attachment contents, while path validation rejects compliant paths and accepts malformed URLs.
3 open issues
What changed in this PR
Adds GEDZIP support to the GEDCOM library, allowing datasets and their local media files to be read and written together.
Changes:
- Adds archive reading, writing, and missing-file reporting.
- Introduces path helpers and configurable media compression.
- Exposes the main APIs and adds documentation and tests.
| File | Description |
|---|---|
test/test_gedzip.py |
Tests paths, archive round trips, and error handling. |
README.md |
Documents basic GEDZIP usage and supported media sources. |
gedcom7/gedzip.py |
Implements archive APIs and local-file path helpers. |
gedcom7/__init__.py |
Exports GedzipReader and dump_gedzip. |
Review effort: Balanced
…pt . and empty segments
There was a problem hiding this comment.
🟡 Changes recommended
Path-backed ZIP writes can alter validated entry names or create a duplicate gedcom.ged entry, causing missing media or making the reader load media instead of the dataset.
1 open issue
3 resolved since last review
Review effort: Balanced
| if isinstance(source, bytes): | ||
| archive.writestr(name, source) | ||
| elif isinstance(source, (str, os.PathLike)): | ||
| archive.write(source, name) |
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.


Adds
gedcom7.gedzip, for GEDZIP archives (GEDCOM 7.0 §4).GedzipReader(file)opens an archive and parsesgedcom.ged. It hasrecords,open(payload),has(payload)andmissing().dump_gedzip(records, file, files)writes an archive.filesmaps each localFILEpayload to bytes, a path, a function that opens the file, orNoneto leave an unavailable file out. It refuses a local file with no content, a file namedgedcom.ged, andfile:URLs. Media is stored uncompressed unlesscompress_files=True.is_local_file,entry_name,file_pathandlocal_filesfollow the spec's rules for local file paths, including percent-encoding.Where media files are stored is up to the caller.