A Python library for parsing GEDCOM files with Ancestry.com export support
Project description
pygedreader
A Python library for parsing GEDCOM 5.5.1 files, with full support for Ancestry.com exports.
Why pygedreader?
Ancestry.com is the largest genealogy platform, but their GEDCOM exports don't strictly follow the spec. They include custom tags, non-standard date formats, and place data where the spec says it shouldn't go. pygedreader was built to handle these quirks so you don't lose valuable family history data.
What we handle:
- MARR events under INDI records - Ancestry puts marriage data on individuals, not just families
- Custom
_tags - Preserves_APID(Ancestry IDs),_MILT(military service),_OID(media IDs), and 30+ other extensions - Inline notes with structured data - Parses "Occupation: Farmer; Marital Status: Married" into key-value pairs
- Non-standard date formats - Handles year ranges like "2010-2019" and slash dates like "05/28/1960"
Installation
pip install pygedreader
Or with uv:
uv add pygedreader
CLI Usage
Show file statistics
pygedreader info family-tree.ged
Output:
File: family-tree.ged
Header:
Source: Ancestry.com Family Trees
GEDCOM: 5.5.1
Charset: UTF-8
Records:
Individuals: 253
Families: 99
Sources: 81
Media Objects: 54
Events:
Individuals with birth: 218
MARR under INDI (Ancestry quirk): 55
Custom events (_MILT, etc.): 2
Export to JSON
# Output to stdout
pygedreader parse family-tree.ged
# Output to file
pygedreader parse family-tree.ged -o output.json
# Compact JSON (no indentation)
pygedreader parse family-tree.ged --indent 0 -o output.json
Library Usage
from pygedreader import parse_file
# Parse a GEDCOM file
gedcom = parse_file("family-tree.ged")
# Access individuals
for person in gedcom.individuals:
print(f"{person.display_name}")
if person.birth and person.birth.date:
print(f" Born: {person.birth.date.original}")
# Ancestry's custom military events
for event in person.custom_events:
if event.tag == "_MILT":
print(f" Military: {event.date.original if event.date else 'unknown'}")
# Traverse family relationships (references auto-resolve)
person = gedcom.get_individual("@I123@")
for fam_link in person.spouse_families:
family = fam_link.family
for child in family.children:
print(f"Child: {child.individual.display_name}")
# Access Ancestry's custom tags
for source in person.sources:
if "_APID" in source.custom_tags:
print(f"Ancestry ID: {source.custom_tags['_APID'][0]}")
Data Model
All records are Pydantic models with full type hints:
Individual- Person with names, events, family linksFamily- Spouses and children with marriage/divorce eventsSource- Bibliographic sources with citationsRepository- Archives and librariesMediaObject- Photos and documents
Every model includes a custom_tags dict that captures non-standard _ prefixed tags, so no Ancestry data is lost.
Development
Clone the repo and install dependencies:
git clone https://github.com/creising/pygedreader.git
cd pygedreader
uv sync
Run the CLI locally:
uv run pygedreader info family-tree.ged
uv run pygedreader parse family-tree.ged -o output.json
Use the library in a Python script:
uv run python -c "
from pygedreader import parse_file
gedcom = parse_file('family-tree.ged')
print(gedcom.stats)
"
Run type checking and linting:
uv run mypy src tests
uv run ruff check .
uv run pytest
License
MIT
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 pygedreader-0.1.0.tar.gz.
File metadata
- Download URL: pygedreader-0.1.0.tar.gz
- Upload date:
- Size: 49.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19d226047d26798084aeef6a7d83c4a0d32b428ee3d106cb806f27a0185bc668
|
|
| MD5 |
bd0ccd97fd188d660ceb2a4a9cf40a8d
|
|
| BLAKE2b-256 |
7a59b7cb96f3eb0cf126e9c888dcf1baf50292c611a96217cb28f9684183ff5f
|
Provenance
The following attestation bundles were made for pygedreader-0.1.0.tar.gz:
Publisher:
publish.yml on creising/pygedreader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygedreader-0.1.0.tar.gz -
Subject digest:
19d226047d26798084aeef6a7d83c4a0d32b428ee3d106cb806f27a0185bc668 - Sigstore transparency entry: 752352809
- Sigstore integration time:
-
Permalink:
creising/pygedreader@9451229d064ad9f55e1f5d9004e2a398fb7d128e -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/creising
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9451229d064ad9f55e1f5d9004e2a398fb7d128e -
Trigger Event:
release
-
Statement type:
File details
Details for the file pygedreader-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pygedreader-0.1.0-py3-none-any.whl
- Upload date:
- Size: 38.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd0d3c1711f7b58e03743bf5ab4b7b53e89d887527e098c8211e9da13fe53a2b
|
|
| MD5 |
6776284b60b1ee93d5adc1d8e81653cc
|
|
| BLAKE2b-256 |
b446fce78690483c1f7f00f0f4d575a20a8ec56ba21e62f5d4331f16acdf143d
|
Provenance
The following attestation bundles were made for pygedreader-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on creising/pygedreader
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygedreader-0.1.0-py3-none-any.whl -
Subject digest:
cd0d3c1711f7b58e03743bf5ab4b7b53e89d887527e098c8211e9da13fe53a2b - Sigstore transparency entry: 752352822
- Sigstore integration time:
-
Permalink:
creising/pygedreader@9451229d064ad9f55e1f5d9004e2a398fb7d128e -
Branch / Tag:
refs/tags/0.1.0 - Owner: https://github.com/creising
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9451229d064ad9f55e1f5d9004e2a398fb7d128e -
Trigger Event:
release
-
Statement type: