A lightweight, fidelity-preserving GEDCOM parser, writer, and CLI for genealogy files (5.5.1, 5.5.5, and FamilySearch GEDCOM 7).
Project description
gedcom-lite
A lightweight, fidelity-preserving GEDCOM parser, writer, and command-line toolkit for genealogy files. Supports GEDCOM 5.5.1, 5.5.5, and the current FamilySearch GEDCOM 7.0+ standard.
The "lite" in the name is a deliberate scope choice: pure Python, no runtime dependencies, no schema validation, no genealogy domain modelling beyond what the file format itself defines. The library models GEDCOM as a tree of Structure records and exposes search and mutation primitives that round-trip every file in the official sample suite byte-for-byte.
Why use it
- Round-trip fidelity. Parse a file and write it back unchanged: BOM, line endings,
CONC/CONTchoice, sibling order, and unknown extension tags are all preserved. - Targeted edits. Mutation primitives mark only the structures you change as dirty; every other line emits byte-identical to the source. An update that touches a single
NAMEproduces a one-line diff. - Encoding coverage. Detects UTF-8 (with or without BOM), UTF-16 LE/BE (with BOM), and ANSEL (legacy 5.5.1) — the ANSEL codec ships in-package.
- No dependencies. Pure Python 3.11+ standard library.
- Three CLI tools.
gedcom-read,gedcom-search,gedcom-updatecover the common verbs without scripting.
Install
# from PyPI
pip install gedcom-lite
# from git
pip install "git+https://github.com/vaelen/gedcom-lite@v0.1.0"
# editable, for hacking
git clone https://github.com/vaelen/gedcom-lite
cd gedcom-lite
pip install -e ".[dev]"
Library usage
from gedcom_lite import GedcomDocument
doc = GedcomDocument.parse("tree.ged")
print(doc.version) # '7.0'
print(doc.encoding) # 'utf-8-sig'
print(doc.record_counts()) # {'INDI': 142, 'FAM': 47, ...}
indi = doc.resolve("@I1@")
name = indi.find("NAME")
name.set_payload("Jane /Doe/")
doc.write("tree-edited.ged")
The full surface is documented in src/gedcom_lite/__init__.py. Common helpers:
from gedcom_lite import (
GedcomDocument, Structure,
parse_date_value, DateValue,
parents_of, children_of, ancestors_of, descendants_of,
document_to_dict, structure_to_dict,
)
CLI usage
Three console scripts are installed:
gedcom-read FILE [...]
gedcom-search FILE [filters...]
gedcom-update FILE [-o OUT | --in-place] SUBCOMMAND ...
Examples:
# overview of a file
gedcom-read tree.ged
# list every individual
gedcom-read tree.ged list INDI
# show one record with pointers resolved
gedcom-read tree.ged record @I1@
# JSON dump for piping into jq
gedcom-read tree.ged --json | jq '.records | length'
# find people named Smith
gedcom-search tree.ged --person Smith
# people born between 1900 and 1910
gedcom-search tree.ged --born-between 1900 1910
# children, parents, ancestors, descendants
gedcom-search tree.ged --children-of @I1@
gedcom-search tree.ged --ancestors-of @I1@ --depth 4
# edit a name (default writes to stdout)
gedcom-update tree.ged set-payload @I1@ NAME "Jane /Doe/" > new.ged
# add a NOTE to a record (write to a file)
gedcom-update tree.ged -o new.ged add-substructure @I1@ "" NOTE "Met at reunion"
# delete a record, voiding inbound pointers
gedcom-update tree.ged -o new.ged delete-record @I7@ --orphan-pointers void
# overwrite the source (be sure)
gedcom-update tree.ged --in-place set-payload @I1@ NAME "Jane /Doe/"
gedcom-update never modifies the input file unless --in-place is given.
Run any tool with --help for the full flag list.
Tests
pip install -e ".[dev]"
pytest
The suite covers:
- Tokenizer edge cases (xref slot, missing payload, malformed lines)
- Encoding detection (BOM-first, then
1 CHAR, then ANSEL) - ANSEL codec round-trips, including combining-mark ordering
- Date parsing across
ABT,BET … AND …,FROM … TO …, calendar escapes - Round-trip of every fixture in
examples/(the gating test) - Mutation primitives, including the "only-touched-lines-change" property
- Ancestry/descendancy traversal
- CLI smoke tests for
gedcom-read,gedcom-search,gedcom-update
Releasing
Maintainer notes — releases publish to PyPI from .github/workflows/release.yml via OIDC trusted publishing (no stored tokens).
- Bump the version in
pyproject.toml,src/gedcom_lite/__init__.py, andCHANGELOG.md. Push the changes to themainbranch. - (Optional) Rehearse to TestPyPI:
gh workflow run release.yml. - Cut the release:
gh release create vX.Y.Z --generate-notes. The workflow builds and uploads to PyPI on therelease: publishedevent.
The PyPI / TestPyPI trusted-publisher entries and the matching pypi / testpypi GitHub Environments are one-time setup, documented at the top of release.yml. CI runs pytest on push and PR across Python 3.11/3.12/3.13.
Versions in scope
- GEDCOM 5.5.1 (1999) — the de-facto interchange format used by virtually every genealogy app shipped before 2022.
- GEDCOM 5.5.5 (2019) — cleanup release of the 5.5.x line.
- FamilySearch GEDCOM 7.0+ (2021–) — current, actively maintained. UTF-8 only, real extension mechanism, GEDZIP packaging, no
CONC.
GEDCOM 7 is a breaking change from 5.5.x. gedcom-lite reads any of the three; on write it never silently promotes a file to a different version.
License
MIT — see LICENSE.
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gedcom_lite-0.1.0.tar.gz.
File metadata
- Download URL: gedcom_lite-0.1.0.tar.gz
- Upload date:
- Size: 130.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4329f9b351e0de45a828788ea5f90634326b2ae6a047beeef6bc54d93654e67d
|
|
| MD5 |
cff55b44aad8bdd802ba0153484d9551
|
|
| BLAKE2b-256 |
ea1de9708ded708b393dbd6310892ecd9fb19b5bb0fed98bc6ce2626e65fa412
|
Provenance
The following attestation bundles were made for gedcom_lite-0.1.0.tar.gz:
Publisher:
release.yml on vaelen/gedcom-lite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gedcom_lite-0.1.0.tar.gz -
Subject digest:
4329f9b351e0de45a828788ea5f90634326b2ae6a047beeef6bc54d93654e67d - Sigstore transparency entry: 1440360496
- Sigstore integration time:
-
Permalink:
vaelen/gedcom-lite@016c45becb1f64f03727ca048b8dd20da406104c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/vaelen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@016c45becb1f64f03727ca048b8dd20da406104c -
Trigger Event:
release
-
Statement type:
File details
Details for the file gedcom_lite-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gedcom_lite-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
019775804bb95392de390c0572aa163243908460637afacffd6ddd10ef70bb30
|
|
| MD5 |
92e6edd02e415b26a7dec813e1095a7d
|
|
| BLAKE2b-256 |
4c4d51e0b9a3cd04bf49200e29ba9b72991453ef9a67b43348ab03e584a3143a
|
Provenance
The following attestation bundles were made for gedcom_lite-0.1.0-py3-none-any.whl:
Publisher:
release.yml on vaelen/gedcom-lite
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gedcom_lite-0.1.0-py3-none-any.whl -
Subject digest:
019775804bb95392de390c0572aa163243908460637afacffd6ddd10ef70bb30 - Sigstore transparency entry: 1440360571
- Sigstore integration time:
-
Permalink:
vaelen/gedcom-lite@016c45becb1f64f03727ca048b8dd20da406104c -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/vaelen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@016c45becb1f64f03727ca048b8dd20da406104c -
Trigger Event:
release
-
Statement type: