The Debtags python library is not as complete as the C++ library but it's the best place to start playing with Debtags and prototyping code.
It can be found as part of the
python-debian package, which also comes with
many examples. All methods are documented, and the package has a
README.Debtags file with the aggregated documentation.
The core of the Python library is the
DB object, which stores the mapping
from package names to tag names and vice versa. Packages and tags are
represented as simple strings.
There are two C++ libraries that can be used to manipulate tag data:
libtagcoll provides generic functions to handle "items" tagged with "tags",
without putting any limit on what an "item" and a "tag" are.
libept is designed to be the engine of a full-featured package manager
application, and it implements a specialisation of
libtagcoll for the Debian
and Debtags case. It is currently used as the engine for the
The library can be used to work with Debian packages and Debtags tags, or with
books and categories, or even people and IRC channels. The item and tag types
are template parameters, and the only requirement on the underlying type is
that it can be stored in a
The library itself is a collection of all sorts of useful code, divided in various sections:
inputis an input stream abstraction used to support deserialisation of tag data.
streamis a collection of functions to handle item and tag information as a stream, and it's useful to perform analysis and changes on the fly while reading or writing tag information.
collcontains various different implementations of collections of tagged items, that the library calls "tagged collections".
diskindexcontains the code to implement a fast, read only index for tag information.
tagexprcontains the code to build and evaluate binary tag expressions as can be seen in
libept provides abstractions for all the elements that a package manager
application needs to handle: packages, versions, dependencies, caches, tags
and so on.
The main design feature of
libept is that the library can be reconfigured to
use different kinds of packages and caches, allowing a package manager to be
easily from Debian to another distribution based on different technology.
To achieve this, all classes are templatised on a configuration class, that defines what are the classes that implement all the various kinds of components used by the library.
libept, the code that concerns Debtags is found in
ept/cache, and its
main parts are:
debtags/vocabulary.himplements access to the Debtags vocabulary, through the fast on-disk index. It also allows to create
Tagobjects from facet and tag anmes.
debtags/tagmap.himplements the association between
Tagobjects, using the fast on-disk index. This is the part that implements the specialisation of
debtags/update.himplements rebuilding all the data files and indexes in the