A BeerXML Parser
Project description
# pybeerxml
A simple BeerXML parser for Python
[![CircleCI](https://circleci.com/gh/hotzenklotz/pybeerxml/tree/master.svg?style=svg)](https://circleci.com/gh/hotzenklotz/pybeerxml/tree/master)
[![PyPi Version](https://img.shields.io/pypi/v/pybeerxml.svg?style=flat-square)](https://pypi.python.org/pypi?:action=display&name=pybeerxml&version=1.0)
Parses all recipes within a BeerXML file and returns <Recipe> 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)
```
## Testing
Unit test can be run with PyTest:
```
python setup.py test
```
## License
MIT
A simple BeerXML parser for Python
[![CircleCI](https://circleci.com/gh/hotzenklotz/pybeerxml/tree/master.svg?style=svg)](https://circleci.com/gh/hotzenklotz/pybeerxml/tree/master)
[![PyPi Version](https://img.shields.io/pypi/v/pybeerxml.svg?style=flat-square)](https://pypi.python.org/pypi?:action=display&name=pybeerxml&version=1.0)
Parses all recipes within a BeerXML file and returns <Recipe> 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)
```
## Testing
Unit test can be run with PyTest:
```
python setup.py test
```
## License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pybeerxml-1.0.4.tar.gz
(5.5 kB
view hashes)
Built Distribution
Close
Hashes for pybeerxml-1.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eebaaf30eddbd430cfd5257a8508b936b4cef0bc8b7dad1ac9a05131bd32324b |
|
MD5 | ea741c11d602e2727787a7366b50518d |
|
BLAKE2b-256 | 99deb816cffc47804ca6ec9361a46d008b278239977dc41755d7ee58f62ebcc3 |