A BeerXML implementation for Python
Project description
pybeerxml
A simple BeerXML parser for Python
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
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:
python -m pytest tests
Contributing / Development
Community contributions are welcome.
Some kind of virtual environment for Python is recommended. Consider venv, condaor similar. Dependency management is handled through Poetry:
pip install poetry
poetry install
Make sure to Test, Lint, Format, & Type-Check your code before sending a pull request:
python -m pytest tests
python -m black pybeerxml tests/*.py
python -m pylint pybeerxml tests/*.py
python -m mypy pybeerxml tests/*.py
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pybeerxml-2.1.2.tar.gz.
File metadata
- Download URL: pybeerxml-2.1.2.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.0 CPython/3.7.9 Linux/5.4.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d81eb70d893961d642f652460a5577e162fc65b18954cee7dc1580f93b9c3087
|
|
| MD5 |
ae505d291eb593d5619e79a5a296437a
|
|
| BLAKE2b-256 |
9815a094648980e7d2ff12d2d5d6f823bcc7dcf35a2c2ecbdcc2c471e8b2297f
|
File details
Details for the file pybeerxml-2.1.2-py3-none-any.whl.
File metadata
- Download URL: pybeerxml-2.1.2-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.0 CPython/3.7.9 Linux/5.4.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd769eb03a042f83660985b0c305df800633ba813255b6eb750c50b37eec0694
|
|
| MD5 |
bed3eccdbc2a774f167270cb7ee2bf6b
|
|
| BLAKE2b-256 |
7d5fea226269e7c159d39300b10d3e4fc6d4bf270fa0ecba9ba50d800202384a
|