Skip to main content

gedcom7

Tests PyPI Python versions License: MIT

Read and write GEDCOM 7 files in Python — a format for exchanging genealogical data between family history applications.

Background

Reading and writing are both based on regular expressions generated directly from the ABNF grammar via abnf-to-regexp, and on the structure and payload tables extracted from the specification. The library targets FamilySearch GEDCOM 7.0.18: it does not attempt to parse files that are not standards compliant, and raises rather than writing malformed lines.

Installation

python -m pip install gedcom7

Usage

import gedcom7

with open("my_gedcom.ged", "rb") as f:
    records = gedcom7.load(f)

with open("out.ged", "wb") as f:
    gedcom7.dump(records, f)

Each record is a GedcomStructure with a tag, an optional xref and pointer, the raw text payload, and children. Its value property casts the payload to the data type the specification gives that structure type.

loads and dumps are the string equivalents. Non-conforming input raises GedcomParseError, a ValueError carrying line_number. A pointer to a record that does not exist is kept rather than rejected; gedcom7.validate(records) lists each one as a dangling-pointer error.

validate returns a list of Error, each with a category, a message and the path to the structure, such as @I1@ INDI > BIRT > DATE. An Error whose severity is "recommendation" breaks only a recommendation of the specification, so the dataset still conforms; dumps(records, validate=True) raises only for the others. An empty list does not prove a dataset conforms: cardinality and enumeration values are not checked, and substructures of extensions are left to the extension's own definition.

GEDZIP

with gedcom7.GedzipReader("family.gdz") as archive:
    records = archive.records
    with archive.open("media/photo.jpg") as f:  # a FILE payload
        data = f.read()

gedcom7.dump_gedzip(records, "out.gdz", {"media/photo.jpg": data})

File content can be given as bytes, a path, or a function returning an open binary file. Where the files are stored is left to the caller.

Development

python -m pip install --group dev --editable .
pytest && mypy && ruff check . && ruff format --check .

The version is derived from git tags by setuptools-scm. To release, push a vX.Y.Z tag and publish a GitHub release for it.

Credits

Inspiration was drawn from the Javascript parser.

Metadata

Release files for gedcom7 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gedcom7 1.4.0
File Size Uploaded Provenance Actions
gedcom7-1.4.0.tar.gz 66.7 kB With provenance Details for gedcom7-1.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gedcom7 1.4.0
File Interpreter ABI Platform Actions
gedcom7-1.4.0-py3-none-any.whl Python 3 none any Details for gedcom7-1.4.0-py3-none-any.whl

Total release size: 102.8 kB

Release files / gedcom7-1.4.0.tar.gz

Download URL gedcom7-1.4.0.tar.gz
Size 66.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9e8e997bbbc789426025c86a213a9d6ba95bd2a07ba2329aa082c8579563f872
BLAKE2b-256 checksum
How to use checksums
3e1ce94734b57c72fd0d1b289121096609fec735a60bafb135f5108d237bcdb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Release files / gedcom7-1.4.0-py3-none-any.whl

Download URL gedcom7-1.4.0-py3-none-any.whl
Size 36.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b097042efa4eed7150dab81eb622ed1d03fa9b3bb158b38125dbb757edb5a222
BLAKE2b-256 checksum
How to use checksums
52c35a0e2c955d211ad92e5146dcefc6557fc079c7c3db187e52f3cdae0037b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for gedcom7 1.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for gedcom7-1.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page