Skip to main content

Python library to access CLDF reference catalogs

Project description

cldfcatalog

Utilities to use git repository clones and reference catalogs.

Build Status codecov PyPI

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cldfcatalog-1.3.0.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

cldfcatalog-1.3.0-py2.py3-none-any.whl (11.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file cldfcatalog-1.3.0.tar.gz.

File metadata

  • Download URL: cldfcatalog-1.3.0.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.5.2

File hashes

Hashes for cldfcatalog-1.3.0.tar.gz
Algorithm Hash digest
SHA256 f581c4bb5a403d7807e14f3678f72cc49e2faba48cb0846d410845c71f4f97a5
MD5 c788137f9b39df790c091896c36c0bcb
BLAKE2b-256 251d1dcc2fce702868540fe5a439757ea0b5aae9cf2154de3db3cd16bd113d3a

See more details on using hashes here.

Provenance

File details

Details for the file cldfcatalog-1.3.0-py2.py3-none-any.whl.

File metadata

  • Download URL: cldfcatalog-1.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.5.2

File hashes

Hashes for cldfcatalog-1.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 48f0de26f4ffbac1e61f101c95f10b4a53b517de70375cbd0e81fbd23e1ac7ea
MD5 0bfc8631e2ba5787cf39588e08bcf35e
BLAKE2b-256 da7494221fe8758cf5aa0d8566df05c569ce427aaef38f6937d959798229988a

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page