Python library to access CLDF reference catalogs
Project description
cldfcatalog
Utilities to use git
repository clones and reference catalogs.
Research data - and in particular CLDF data - is often curated using git
repositories
for version control. cldfcatalog.Repository
provides a wrapper around GitPython's git.Repo
class, exposing relevant functionality
in this context.
A particularly important piece of data for CLDF are reference catalogs, which are
consulted during CLDF data creation. Again, such catalogs are often available as
git
repositories hosted on GitHub, such as
Glottolog or
Concepticon.
The typical usage scenario for these catalogs is as follows:
- To follow upstream development of the catalogs, a user has a local clone of the
repository, which is periodically synched running
git pull origin
. - When creating a CLDF dataset, a particular released version of a catalog is consulted.
Thus, we want to
- checkout a particular version of the catalog,
- run the CLDF creation,
- restore the previous state of the repository clone.
This is exactly the functionality of cldfcatalog.Catalog
:
>>> from cldfcatalog import Catalog
>>> glottolog = Catalog('../../glottolog/glottolog', 'v4.0')
>>> glottolog.active_branch
'master'
>>> with glottolog:
... print(glottolog.describe())
...
v4.0
>>> glottolog.describe()
'v4.0-52-ga4cfc90'
Configuration
cldfcatalog
supports discovery of local paths to catalog clones via a configuration file.
If a file catalog.ini
is found at appdirs.user_config_dir('cldf')
(see appdirs) is found, its clones
section is used as a
mapping from Catalog.cli_name()
to clone path. Thus, with a configuration
[clones]
clts = /home/forkel/.config/cldf/clts
a catalog can be intialized as
with Catalog.from_config('clts', tag='v1.0'):
...
When cloning a catalog,
running Catalog.clone
,appdirs.user_config_dir('cldf')
will be used as directory for
the clone, and the path will be written to the config file.
To add add paths to a config file use it as context manager:
from cldfcatalog import Config
with Config.from_file() as cfg:
cfg.add_clone(key, path)
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
File details
Details for the file cldfcatalog-1.5.1.tar.gz
.
File metadata
- Download URL: cldfcatalog-1.5.1.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/28.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.6 tqdm/4.56.2 importlib-metadata/4.10.1 keyring/22.0.1 rfc3986/1.5.0 colorama/0.4.3 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 469fd867623f26e4904e19e5e78fb58d4215e1841996cd7f3eb50f35f7e02684 |
|
MD5 | c15699a968e22c9acda9e24beac0013f |
|
BLAKE2b-256 | f065a345e970db1f4c99593a9febbb9b2bf190dd623ae368bd09bfe7a04c78a7 |
File details
Details for the file cldfcatalog-1.5.1-py2.py3-none-any.whl
.
File metadata
- Download URL: cldfcatalog-1.5.1-py2.py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/28.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.6 tqdm/4.56.2 importlib-metadata/4.10.1 keyring/22.0.1 rfc3986/1.5.0 colorama/0.4.3 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d513339c609c3ceb570941ccdb276a284cbb7e32cceeabe141b1b0df07761a49 |
|
MD5 | 31a0139f4d3bab9558363a21d693675d |
|
BLAKE2b-256 | bc82b649f1b6610b89663d4c9d2ac10ae73a79afedc8a53b8ad7f2a7f9f95e6d |