pybeerxml
A simple BeerXML parser and serializer 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). Recipes can also be serialized back to BeerXML. All models are built on
pydantic and pydantic-xml.
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)
Serialization
Write recipes back to BeerXML with the Serializer class. Only values stored in the XML-backed
fields are written — calculated properties (og_calculated, og_plato, etc.) are never serialized.
The stored values for OG, FG, IBU, ABV and color live in the trailing-underscore fields og_,
fg_, ibu_, abv_ and color_.
from pybeerxml import Parser, Serializer
parser = Parser()
recipes = parser.parse("/tmp/SimcoeIPA.beerxml")
serializer = Serializer()
# serialize to a string
xml_string = serializer.serialize(recipes)
# or write to a file
serializer.write(recipes, "/tmp/SimcoeIPA-copy.beerxml")
Since all models are pydantic models, you can also build recipes programmatically:
from pybeerxml import Serializer
from pybeerxml.recipe import Recipe
from pybeerxml.hop import Hop
recipe = Recipe(name="My IPA", batch_size=20.0)
recipe.hops.append(Hop(name="Simcoe", alpha=13.0, amount=0.05, use="boil", time=60))
print(recipe.og_calculated)
xml_string = recipe.to_xml_string()
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
Metadata
Release files for pybeerxml 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pybeerxml-3.0.0.tar.gz | 119.6 kB | With provenance | Details for pybeerxml-3.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pybeerxml-3.0.0-py3-none-any.whl | Python 3 | none | any | Details for pybeerxml-3.0.0-py3-none-any.whl |
Total release size: 140.2 kB
Release files / pybeerxml-3.0.0.tar.gz
| Download URL | pybeerxml-3.0.0.tar.gz |
|---|---|
| Size | 119.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
83527754db76300af927b4e5fdb6fda63c4a3381207034235648d852e21349fb
|
|
BLAKE2b-256 checksum How to use checksums |
29d60ed562c733f4154883bd1cabb73c2b01c28ecf18630d3c12ec8170cd998f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.
Transparency logRelease files / pybeerxml-3.0.0-py3-none-any.whl
| Download URL | pybeerxml-3.0.0-py3-none-any.whl |
|---|---|
| Size | 20.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e07e3eeb3bde085d9b0cd7ddc0b56fc2f008d5f82d1fe7ec4d360a747eef1f69
|
|
BLAKE2b-256 checksum How to use checksums |
55ac9d018c92c88abe5308d1c6247e6ae4b7ad42f9652bcba2492f20397ceede
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.
Transparency logSecurity for pybeerxml 3.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pybeerxml-3.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.