Add write support - #10
Merged
Merged
Conversation
DavidMStraub
requested
a lite review from Copilot
and removed request for
Copilot
August 12, 2026 14:26
There was a problem hiding this comment.
Pull request overview
Adds GEDCOM 7 serialization (“write support”) to complement the existing parser, including a public API (dump/dumps) and comprehensive round-trip/validation tests.
Changes:
- Introduces
gedcom7.serializerwithdumps()/dump()and serialization validations (tags, xrefs/pointers, CONT splitting, banned characters, BOM, line terminators). - Updates core types/exceptions and package exports to support reliable equality (parent excluded from comparisons) and a new
GedcomSerializeError. - Adds serializer-focused tests and updates README to document parsing + writing usage.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/test_serializer.py | New test suite covering round-trips, encoding details, and serialization error cases |
| README.md | Updates project description and adds serializer usage + dev command summary |
| gedcom7/types.py | Excludes parent from dataclass comparison/repr to prevent recursive equality/representation |
| gedcom7/serializer.py | New serializer implementation providing dumps/dump with spec-aligned formatting and validations |
| gedcom7/exceptions.py | Adds GedcomSerializeError exception type |
| gedcom7/init.py | Exports serializer API (dump, dumps) and GedcomSerializeError |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
Suppressed comments (3)
gedcom7/serializer.py:24
- The BOM constant is defined as an invisible literal character, which is easy to miss/corrupt in editors and diffs. Using an explicit "\ufeff" escape makes this clearer and less error-prone.
_BOM = ""
test/test_serializer.py:81
- This test asserts on an invisible BOM literal character. Using the explicit "\ufeff" escape makes the intent clearer and avoids issues if the file encoding/renderer hides or mangles the character.
"""The specification says a data stream should begin with U+FEFF."""
out = gedcom7.dumps(gedcom7.loads(HEAD + TRLR))
assert out.startswith("")
assert gedcom7.dumps(gedcom7.loads(HEAD + TRLR), byte_order_mark=False) == (
HEAD + TRLR
README.md:40
- The Development command omits the formatting check that CI enforces (workflow runs
ruff format --check .), so following the README can still fail CI due to formatting.
pytest && mypy && ruff check .
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.