Skip to content

lotho/pybeerxml

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pybeerxml

A simple BeerXML parser for Python

Build Status PyPi Version

Parses all recipes within a BeerXML file and returns object containing all ingredients, style information and metadata. OG, FG, ABV and IBU are calculated from the ingredient list. (your milage may vary)

Installation

pip install pybeerxml

Usage

from pybeerxml import Parser

path_to_beerxml_file = "/tmp/SimcoeIPA.beerxml"

parser = Parser()
recipes = parser.parse(path_to_beerxml_file)

for recipe in recipes:

    # some general recipe properties
    print(recipe.name)
    print(recipe.brewer)

    # calculated properties
    print(recipe.og)
    print(recipe.fg)
    print(recipe.ibu)
    print(recipe.abv)

    # iterate over the ingredients
    for hop in recipe.hops:
        print(hop.name)

    for fermentable in recipe.fermentables:
        print(fermentable.name)

    for yeast in recipe.yeasts:
        print(yeast.name)

    for water in recipe.waters:
        print(water.name)

    for misc in recipe.miscs:
        print(misc.name)

    # show information for the mash process
    print(recipe.mash.name)

    # iterate over the mashing steps
    for mash_step in recipe.mash.steps:
        print(mash_step.name)

    # show equipment information
    print(recipe.equipment.name)


Testing

Unit test can be run with PyTest:

py.test tests

License

MIT

About

A simple BeerXML parser for Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%