Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 803 Bytes

README.md

File metadata and controls

33 lines (25 loc) · 803 Bytes

sugarcube

sugarcube is a single-file python API to convert cooking ingredients to various measurements. It is compatible with python 2.7 and python 3.4

Installation

using pip pip install https://github.com/vizigr0u/sugarcube/tarball/master

or without pip

git clone https://github.com/vizigr0u/sugarcube.git
cd sugarcube
python setup.py install

Usage

Converting grams of flour into cups:

from sugarcube import Mass, Volume, Flour

ingredient = 250 * Mass.gram * Flour
print("%s = %s" % (ingredient, ingredient.to(Volume.cup)))
# prints: 250 g Flour = 1.4881 cup Flour

help(sugarcube) contains several usage examples

Unit measures

Non-metric units are based on modern US standards :

  • 1 cup = 240ml (FDA/'US legal' definition)
  • 1 pound = 453.59237 grams