Skip to content

hotzenklotz/pybeerxml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

118 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pybeerxml

A simple BeerXML parser for Python

PyPi Version Build Status Code Style Docs

Parses all recipes within a BeerXML file and returns Recipe objects 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

Full documentation is available at pybeerxml.onrender.com.

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 misc in recipe.miscs:
        print(misc.name)

Testing

Unit tests can be run with pytest:

uv run pytest

Contributing / Development

Community contributions are welcome.

Install uv, then sync dependencies:

uv sync

Make sure to test, lint, format, and type-check your code before sending a pull request:

uv run pytest
uv run ruff format .
uv run ruff check .
uv run ty check pybeerxml

License

MIT

About

A simple BeerXML parser for Python

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages