yamily
Define family trees in YAML
Setup
Debian / Ubuntu
$ sudo apt-get install python3-yaml python3-graphviz
$ pip3 install --user --upgrade yamily
Mac
$ brew install graphviz
$ pip3 install --upgrade yamily[yaml,graphviz]
Windows
- Download and install Graphviz.
- Download and install Python.
- Open Command Prompt /
cmd.exe. - Run command
pip install --user --upgrade yamily[yaml,graphviz].
Usage
Import YAML
>>> import yaml, yamily, yamily.yaml
>>> alice_yaml = '''
... !person
... identifier: alice
... name: Alice Test
... birth_date: 1919-12-23
... mother: !person
... identifier: alice-mother
... name: Carol Test
... birth_date: 1892-10-26
... death_date: 1983-11-02
... father: !person
... identifier: bob
... name: Bob Test
... '''
>>> alice = yaml.load(alice_yaml, Loader=yamily.yaml.Loader)
>>> alice
Person(alice, Alice Test, *1919-12-23)
>>> alice.mother
Person(alice-mother, Carol Test, *1892-10-26, †1983-11-02)
Multiple YAML Files
>>> alice_yaml = '''
... !person
... identifier: alice
... name: Alice Test
... birth_date: 2019-12-23
... mother: carol
... '''
>>> carol_yaml = '''
... !person
... identifier: carol
... name: Carol Test
... birth_date: 1992-10-26
... '''
>>> collection = yamily.PersonCollection()
>>> for person_yaml in [alice_yaml, carol_yaml]:
... person = yaml.load(person_yaml, Loader=yamily.yaml.Loader)
... collection.add_person(person)
Person(alice, Alice Test, *2019-12-23)
Person(carol, Carol Test, *1992-10-26)
>>> collection['alice'].mother
Person(carol, Carol Test, *1992-10-26)
>>> collection['carol'] is collection['alice'].mother
True
Export YAML
>>> import datetime, yaml, yamily, yamily.yaml
>>> alice = yamily.Person("alice")
>>> alice.name = "Alice Test"
>>> alice.birth_date = datetime.date(2019, 12, 23)
>>> alice
Person(alice, Alice Test, *2019-12-23)
>>> alice.father = yamily.Person("alice-father")
>>> alice.father.name = "Bob Test"
>>> print(yaml.dump(alice, Dumper=yamily.yaml.Dumper))
!person
birth_date: 2019-12-23
father: !person
identifier: alice-father
name: Bob Test
identifier: alice
name: Alice Test
<BLANKLINE>
Plot Family Tree
$ yamily-dot . > tree.dot
$ dot -Tpdf -O tree.dot
Develop
$ git clone git@git.hammerle.me:fphammerle/yamily.git
$ cd yamily
$ git config --local core.hooksPath .githooks/
Release files for yamily 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| yamily-0.2.0.tar.gz | 31.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| yamily-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 52.8 kB
Release files / yamily-0.2.0.tar.gz
| Download URL | yamily-0.2.0.tar.gz |
|---|---|
| Size | 31.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4f080b4c9e27dadba929863d51ee07b28938457846037fffc64982772084c319
|
|
BLAKE2b-256 checksum How to use checksums |
8c2db4cb2d0e0b3468a0f1f004a8ecfc23739eb1295e65a95bb2686109242567
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.9
|
Release files / yamily-0.2.0-py3-none-any.whl
| Download URL | yamily-0.2.0-py3-none-any.whl |
|---|---|
| Size | 21.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
00079bdd367793d622c36210ff83e826ff409745d4023d7d9a316ef726922462
|
|
BLAKE2b-256 checksum How to use checksums |
182423650c9cc473bdd648a50729f68b4e0fe46eb4e2d5f14f9e346b8c916384
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.9
|