Skip to main content

A BeerXML implementation for Python

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pybeerxml-2.2.0.tar.gz (59.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybeerxml-2.2.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file pybeerxml-2.2.0.tar.gz.

File metadata

  • Download URL: pybeerxml-2.2.0.tar.gz
  • Upload date:
  • Size: 59.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pybeerxml-2.2.0.tar.gz
Algorithm Hash digest
SHA256 55d3d941953610083f96ae2fd5c80ac6d41a0699e1804306049b0d4904caecff
MD5 3fdf272bfc1a3643155c39f6880f9631
BLAKE2b-256 b7ca4e57a081fe3a41788b423af3a0014272136e609155f50201e5f7b38e5728

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybeerxml-2.2.0.tar.gz:

Publisher: publish_pypi.yml on hotzenklotz/pybeerxml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pybeerxml-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: pybeerxml-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pybeerxml-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 edd8b56c5695f4c9f10345563b26e8d90ad4127f29e69f8eeb2ac39375478c30
MD5 c4e6d96e9f73ab0339f2b22f57d6cdbd
BLAKE2b-256 cb6ebbd1643f5a593da13875fbbd24ebf06675a4837e2fa3ddcbf906b5ef97eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybeerxml-2.2.0-py3-none-any.whl:

Publisher: publish_pypi.yml on hotzenklotz/pybeerxml

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page