Quick start

pyversion version license travis

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()

# create your recipe
recipe = Recipe(
   name="Test", brewer="TROUVERIE Joachim", type="Pale Ale",
   batch_size=10.0, boil_time=60.0, boil_size=15.0, style="Test"
)

# convert it to yaml
yaml_data = recipe.to_yaml()

Testing

Unit tests can be run with pytest.

python -m pytest tests