Skip to main content

FastGedcom

A lightweight tool to parse, browse and edit gedcom files.

pip install fastgedcom

Want to open a gedcom file?

from fastgedcom.parser import guess_encoding, parse

gedcom_file = "my_gedcom_file.ged"
with open(gedcom_file, "r", encoding=guess_encoding(gedcom_file)) as f:
	document, warnings = parse(f)

if warnings: print(warnings) # in case of duplicate record reference

Easy to write! Free choice of fields, data, and formatting.

from fastgedcom.helpers import format_date

birth_date = (document["@I1@"] > "BIRT") >= "DATE"
print(format_date(birth_date))

A field is missing? FakeLine to the rescue. Like a TrueLine, but no error, no value, and no error handling code!

from fastgedcom.base import is_true

indi = document["@I1@"]
death_date = (indi > "DEAT") >= "DATE"
if death_date != "": print(format_date(death_date)) 
if not is_true(indi): print("@I1@ was not even present!")

Don't like magic operator overload? Use standard methods!

indi = document.get_record("@I1@")
surname = indi.get_sub_line("NAME").get_sub_line_payload("SURN")

Typehints for salvation! Autocompletion and type checking make development so much easier.

from fastgedcom.base import Document, FakeLine, IndiRef, Record, is_true
from fastgedcom.helpers import format_name

def print_infos(gedcom: Document, indi: IndiRef) -> None:
	record = gedcom[indi]
	if is_true(record): print_name(record)

def print_name(record: Record | FakeLine) -> None:
	print(format_name(record >= "NAME"))

print_infos(document, "@I1@")

Iteration on families is fast. Save time!

from fastgedcom.family_aid import FamilyAid

booster = FamilyAid(document)

def number_of_ascendants(indi: Record | FakeLine) -> int:
	if not is_true(indi): return 1
	father, mother = booster.get_parents(indi.tag)
	return 1+max(number_of_ascendants(father), number_of_ascendants(mother))

def number_of_descendants(indi: IndiRef) -> int:
	children = booster.get_children_ref(indi)
	return len(children) + sum(number_of_descendants(c) for c in children)

print(max(number_of_ascendants(indi)
	for indi in document.get_records("INDI")
))
print(max(number_of_descendants(indi.tag)
	for indi in document.get_records("INDI")
))

You want to see more? Here are some examples

The documentation of FastGedcom is available here on ReadTheDocs.

I promise you it is efficient! I test it and I use it.

Feature details

  • Supports reading of gedcom files encoded in UTF-8 with and without BOM, UTF-16 (also named UNICODE), ANSI, and ANSEL.
  • Supports export of gedcom files encoded in UTF-8, UTF-16, and ANSI.

Feedbacks

Feedbacks are welcome, and they will be greatly appreciated!

If you like this project, consider putting a star on Github, thank you!

For any feedback or question, please feel free to contact me by email at gatien.bouyer.dev@gmail.com or via Github issues.

Metadata

Release files for fastgedcom 0.0.5

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

Source distribution (sdist)

Source distribution for fastgedcom 0.0.5
File Size Uploaded
fastgedcom-0.0.5.tar.gz 14.8 kB Details

Built distribution (wheel)

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

Total release size: 27.4 kB

Release files / fastgedcom-0.0.5.tar.gz

Download URL fastgedcom-0.0.5.tar.gz
Size 14.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ff86ced04857c044a3e3e7bd546d900599410a3bf9daee9036530bbfc877e4bd
BLAKE2b-256 checksum
How to use checksums
e2c2fd271179de1591cc9475a117b78133bee10f6d64b7ca969b1e0fafd9cc4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / fastgedcom-0.0.5-py3-none-any.whl

Download URL fastgedcom-0.0.5-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
754e3352867fe57bd05129b2aba2d6feadd5fb71050fc8624b249be8fe6fe45d
BLAKE2b-256 checksum
How to use checksums
40e2d68d003854848535518ee87555b0709aa4a34a853eee2e8589e49396fa07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.0.7

2 release files

0.0.6

2 release files

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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