Skip to main content

Python tool to convert YAML shopping list into different formats

Project description

Export YAML shopping lists into different formats.


foodlist converts simple yaml shopping lists into different formats. This can
be done in order to get a better layout or make them importable for other
applications. Originally I built this to be able to write simple grocery lists
on my computer and import them into
Groceries.app_, a wonderful iPhone application for shopping lists.

I tried to built it as abstract as possible, so that new formats could be added

pyyaml for input parsing and pystache for filling the output template. If
pystache is not available or no template was given, the context object is
simply printed onto the screen.


pip install pyyaml
pip install pystache

The package itself can be installed via PyPi:

pip install foodlist

Or if you must:

easy_install foodlist

This does not install the example data from the data folder, however. They are
working examples, but I don't think they are useful enough to be bundled. If
you want to use or modify these examples, feel free to do this.

Create a yaml list like this:


- food
- more food
- tomatoes
- spinache

The executable can be given optional paths for base data needed to convert the
list and a mustache template for output generation.

You can also put your files in the default search location:



Simple execution with format and the default
base_data/template: list.yaml

Template and base data paths given explicitly: -b groceries.json -t groceries.mustache list.yaml

Additionally it is possible to pass a name and the format: -n "My awesome list" -f "" list.yaml

Adding new formats is rather easy. Just add a new converter method with the

def new_converter_method(self, groceries_list, \*\*kwargs)

The parameters are:

* groceries_list = the object parsed from the yaml list
* \*\*kwargs additional arguments like base data path, etc


kwargs = {
"format" : "desired format",
"name" : "name of the list",
"base_data" : "path to base data file"

Then add it to the listformats dict:

listformats = {'keyword': self.new_converter_method}

And that's about it.

Since I don't know if it is okay (license-wise) to bundle json data
from here, no data is included. However it is rather
easy to get a json dump yourself. Just export a shopping list from and search in the plain email text for:


The part after data is the json data which needs to be fed to the application.

* more (or any for that matter) test cases
* more formats

Sophia Teutschler for



0.1.0 (2010-05-23)
* Initial release

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

foodlist-0.1.0.tar.gz (4.7 kB view hashes)

Uploaded source

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