Skip to content

j0ack/pybeeryaml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pybeeryaml

version license drone

A YAML format parser for beer storage

Parse a recipe from a YAML file and returns an object containing ingredients and metadata. Supports export to beerxml format.

Installation

pip install pybeeryaml

Usage

from pybeeryaml import Recipe

path_to_beeryaml_file = "/tmp/my_recipe.yml"

# create recipe from file
recipe = Recipe.from_file(path_to_beeryaml_file)

# or from string
with open(path_to_beeryaml_file, "r") as mybeer:
    recipe2 = Recipe.from_yaml(mybeer.read())

assert recipe == recipe2  # True

# convert to beerxml format
recipexml = recipe.to_xml()

Testing

Unit tests can be run with pytest.

py.test tests