Skip to content

vizigr0u/sugarcube

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

convert food quantities in python

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages