Skip to main content

File-based contact management

Project description

File-based contact management


Each contact corresponds to a single file inside of the bguo directory. Contact information should be edited in this directory and then exported to various output formats for use by other programs. They can also be roughly imported to this directory, but you will have to proofread the results; the importers are intended for one-time imports, not for regular synchronization with other programs.

For our purposes, a contact is a thing with a single name. People, mailing lists, and organizations can all be contacts. bguo has no special features for grouping contacts.

bguo contact file format

Here is an example of a contact file.

name: Thomas Levine
phone: 8835 1000 990 2082
x-favorite-color: pink

The contact file format is similar to that of an email (RFC-5322 internet message) except for the following changes.

  • Header names are different. (See below.)
  • Line breaks do not need to include carriage returns; it is acceptable to break lines either with CRLF or just LF.
  • Non-ASCII data may be included in headers; MIME encoded-word syntax is optional.
  • The message body must be empty.

A contact file may contain any of the following case-insensitive fields and any field beginning with “x-” or “X-“.

Name of a person, mailing list, organization, &c.
Same as “name”, but used when “name” isn’t acceptable for the output format because it is in a different alphabet
Telephone number
Email address
News feed address, like for an RSS or Atom feed
Website address
Postal address

bguo will report an error if any other field is present. Fields marked with “*” may be included multiple times; other fields may be included only once.



pip3 install bguo

The Seltzer importer has a special dependency. If you need the Seltzer importer, install like this in order to ensure that the dependency is met.

pip3 install ‘bguo[seltzer]’


bguo -h

Examples are distributed with the package, in the “examples” directory. pip downloads the package, but you can download the package from PyPI, and you can download the development version from

Here is how you can download the development version and run the examples.

tar xzf bguo.tar.gz
cd bguo/examples
make clean

Supported formats

bguo supports only the formats that I (Tom) have used. Let’s separate the formats into two groups. The first group of formats is for specific integrations with other software.

Konftel 300IP phonebook file
MH aliases file
Mutt alias_file
Newsbeuter ~/.newsbeuter/urls
Seltzer CRM member listing (/?q=members)
voipms phonebook export

The second group is generic exports that could be helpful for making your own exports.

python (the default)
Python string representation, as a list of dicts, one dict per contact
Your own format, specified as a Python format string, using the fields that you can check with the bguo format subcommand

The format arguments include all of the raw fields from the contact file format (name, name-latin, &c.) and the following derived fields.

Phone number from the “phone” field with non-numeric characters removed
Postal address from the “post” field formatted for inclusion on a letter, with the contact’s name or identifier and with slashes replaced by line breaks.

For most of these formats, only the import or the export is supported, not both. This is summarized in the table below.

Format Import Export
Konftel No Yes
MH Yes Yes
Mutt Yes Yes
Newsbeuter Yes Yes
Seltzer Yes No Yes No
Python No Yes
Custom No Yes

For imports, command-line program expects that you are converting from only one format to bguo. To merge multiple formats during an export, write a custom merging program with the functions in bguo.parse. I did this once with email addresses (MH) and phone numbers (VoIP.MS); see examples/

Export workflow

Let us categorize exports into two types.

  1. STDOUT is sent to a configuration file.
  2. STDOUT is sent directly to another program.

An example of the former type is the MH format; I run a command like this, and my contacts are made available when I am composing emails.

bguo export ./my-contacts mh > ~/mh/aliases

An example of the latter type is connecting the generic phone number export to a Session Initicialization Protocol (SIP) client; I can call myself with the following command.

pjsua "$(bguo export ./thomas.levine custom 'sip:{phone-numeric}')"

Project details

Download files

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

Files for bguo, version 0.2.3
Filename, size File type Python version Upload date Hashes
Filename, size bguo-0.2.3.tar.gz (12.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page