pyglottolog
May 5, 2026 ยท View on GitHub
Programmatic access to Glottolog data.
Note
Accessing Glottolog data programmatically has become a lot easier with the
Glottolog CLDF dataset. Thus, pyglottolog now
mostly serves as internal data curation tool.
Install
To install pyglottolog you need a python installation on your system, running python >3.8. Run
pip install pyglottolog
This will also install the command line interface glottolog.
Note: To make use of pyglottolog you also need a local copy of the
Glottolog data. This can be
- a clone of the glottolog/glottolog repository or your fork of it,
- an unzipped released version of Glottolog from GitHub,
- or an unzipped download of a released version of Glottolog from ZENODO.
Make sure you remember where this local copy of the data is located - you may
have to pass this location as option when using pyglottolog.
A convenient way to clone the data repository, keep it updated and access it
from pyglottolog is provided
by cldfbench. See the README for details.
Python API
Using pyglottolog, Glottolog data can be accessed programmatically from within python programs.
All functionality is mediated through an instance of pyglottolog.Glottolog, e.g.
>>> from pyglottolog import Glottolog
>>> glottolog = Glottolog('.')
>>> print(glottolog)
<Glottolog repos v0.2-259-g27ac0ef at /.../glottolog>
For details, refer to the API documentation at readthedocs.
Command line interface
Command line functionality is implemented via sub-commands of glottolog. The list of
available sub-commands can be inspected running
$ glottolog -h
usage: glottolog [-h] [--log-level LOG_LEVEL] [--repos REPOS]
[--repos-version REPOS_VERSION]
COMMAND ...
optional arguments:
-h, --help show this help message and exit
--log-level LOG_LEVEL
log level [ERROR|WARN|INFO|DEBUG] (default: 20)
--repos REPOS clone of glottolog/glottolog
--repos-version REPOS_VERSION
version of repository data. Requires a git clone!
(default: None)
available commands:
Run "COMAMND -h" to get help for a specific command.
COMMAND
create Create a new languoid directory for a languoid
specified by name and level.
edit Open a languoid's INI file in a text editor.
htmlmap Create an HTML/Javascript map (using leaflet) of
Glottolog languoids.
iso2codes Map ISO codes to the list of all Glottolog languages
and dialects subsumed "under" it.
langdatastats List all metadata fields used in languoid INI files
and their frequency.
show Display details of a Glottolog object.
tree Print the classification tree starting at a specific
languoid.
Extracting languoid data
Glottolog data is often integrated with other data or incorporated as reference data in tools, e.g. as LanguageTable in a CLDF dataset.
To do this, the LanguageTable from glottolog/glottolog-cldf can be copied.