Skip to content

Read and write GEDZIP archives - #17

Merged
DavidMStraub merged 3 commits into
mainfrom
gedzip
Nov 13, 2026
Merged

DavidMStraub merged 3 commits into
mainfrom
gedzip

Conversation

@DavidMStraub

Copy link
Copy Markdown
Owner

Adds gedcom7.gedzip, for GEDZIP archives (GEDCOM 7.0 §4).

  • GedzipReader(file) opens an archive and parses gedcom.ged. It has records, open(payload), has(payload) and missing().
  • dump_gedzip(records, file, files) writes an archive. files maps each local FILE payload to bytes, a path, a function that opens the file, or None to leave an unavailable file out. It refuses a local file with no content, a file named gedcom.ged, and file: URLs. Media is stored uncompressed unless compress_files=True.
  • is_local_file, entry_name, file_path and local_files follow the spec's rules for local file paths, including percent-encoding.

Where media files are stored is up to the caller.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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

Comment thread gedcom7/gedzip.py Resolved
Comment thread gedcom7/gedzip.py Resolved
Comment thread gedcom7/gedzip.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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

Comment thread gedcom7/gedzip.py Outdated
if isinstance(source, bytes):
archive.writestr(name, source)
elif isinstance(source, (str, os.PathLike)):
archive.write(source, name)
@DavidMStraub
DavidMStraub merged commit 97095fa into main Nov 13, 2026
6 checks passed
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.

2 participants