Skip to main content

🏢 Builelib

Building Energy-modeling Library

Annual energy consumption calculation program for non-residential buildings

Python License: MIT Version uv

日本語 | Website | Manual | Changelog

Overview

Builelib is a Python library for calculating the annual energy consumption of non-residential buildings. It implements the calculation methods used by Japan's Building Energy Conservation Standard program for non-residential buildings (WEBPRO).

Builelib provides an Excel-based CLI, a Python API, a JSON-based FastAPI application, and a Docker configuration.

Parse an input sheet in memory

from builelib.input import parse_input_sheet

result = parse_input_sheet("input.xlsx")
print(result.data)
print(result.errors, result.warnings)

This API supports .xlsx and .xlsm WEBPRO input sheets and does not create an intermediate JSON file. Envelope consumers can also import calculate_wall_u_value and calculate_window_performance from builelib.input.

Requirements

  • Python 3.12 or later
  • uv
  • Git
  • Docker, only when running the containerized API

Setup

1. Install uv

Windows PowerShell:

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

macOS / Linux:

curl -LsSf https://astral.sh/uv/install.sh | sh

2. Clone the repository and install dependencies

git clone https://github.com/MasatoMiyata/builelib.git
cd builelib
uv sync --locked

uv sync creates the .venv virtual environment and installs the dependencies. --locked uses the committed uv.lock without changing it.

Run from the CLI

Run a calculation

uv run builelib <inputfile>

Replace <inputfile> with the path to an actual .xlsx or .xlsm file. Do not type the angle brackets themselves.

Example using the included sample file:

uv run builelib ./examples/Builelib_inputSheet_sample_001.xlsx

Quote paths that contain spaces.

uv run builelib "C:\path with spaces\input.xlsx"

Validate input without calculating

Pass False as the second argument to parse and validate the Excel input without running the energy calculations.

uv run builelib <inputfile> False

Validation-only mode still writes the converted input, validation results, per-system result files, and a ZIP archive.

Output files

Output files are written next to the input Excel file. Existing files with the same names are overwritten.

Output name Contents
<name>_input.json Input data converted from Excel
<name>_validation.json Input validation results
<name>_result.json Calculation results, including BEI
<name>_result_*.json Per-system calculation results
<name>_result_*.csv Detailed per-system or time-series results from a full calculation
<name>.zip ZIP archive containing the main output files

Run from Python

Calculate from an Excel or JSON file

from builelib.runner import calculate

calculate("./examples/Builelib_inputSheet_sample_001.xlsx")

calculate() accepts a file path and reads Excel (.xlsx, .xlsm) or JSON (.json) according to its extension. It writes JSON, CSV, and ZIP files next to the input file instead of returning the results. For a JSON file, use calculate("input.json"). Pass False as the second argument to skip equipment calculations and validate the input.

calculate("./examples/Builelib_inputSheet_sample_001.xlsx", False)

Calculate from JSON data in memory

calculate_from_json() accepts a dictionary that conforms to webproJsonSchema and returns a result dictionary without creating files.

from builelib.runner import calculate_from_json

output = calculate_from_json(input_data)
print(output["result"])
print(output["errors"])

Run the Web API

Start the local development server:

uv run uvicorn main:app --reload --host 127.0.0.1 --port 8000

After the server starts, open the interactive API documentation:

Main endpoints:

Method Path Description
GET / Health check
GET /calculate Calculate from an Excel file on the server
POST /calculate Calculate from JSON input data
POST /validate Validate JSON input data
GET /schema Retrieve the JSON schema
GET /options Retrieve the available input options
POST /project/{project_id}/save Save a project
GET /project/{project_id} Load a project

Run with Docker

compose.yaml uses an external volume and an external network. Create them once before the first start.

docker volume create builelib_data
docker network create mynetwork

Build and start the service:

docker compose up --build -d

The API documentation is available at http://localhost:8081/docs.

Stop the service with:

docker compose down

The external builelib_data volume is not removed by docker compose down.

Create input data

Enter the building specifications in a WEBPRO input sheet, using the same input procedure as WEBPRO.

Add the Builelib-specific SP sheet (Form SP) to the WEBPRO input sheet to specify detailed calculation conditions. Sample files are available in examples.

See the manual for details.

Tests

uv run python -m pytest tests

Example that runs a specific test file:

uv run python -m pytest tests/test_api.py -v

Remove the development environment

Builelib is installed in the repository-local .venv. To remove the development environment, move to the repository's parent directory and delete the builelib directory.

Windows PowerShell:

cd ..
Remove-Item -Recurse -Force .\builelib

macOS / Linux:

cd ..
rm -rf ./builelib

References

License

MIT License

© Masato Miyata

Metadata

Release files for builelib 2.3.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for builelib 2.3.5
File Size Uploaded Provenance Actions
builelib-2.3.5.tar.gz 2.6 MB With provenance Details for builelib-2.3.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for builelib 2.3.5
File Interpreter ABI Platform Actions
builelib-2.3.5-py3-none-any.whl Python 3 none any Details for builelib-2.3.5-py3-none-any.whl

Total release size: 5.3 MB

Release files / builelib-2.3.5.tar.gz

Download URL builelib-2.3.5.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
124c23d4873a70642f0526236ea9a7b07c6cefa429d6bcaf6b1b2f9f505b2acc
BLAKE2b-256 checksum
How to use checksums
86d6eda286790fcd6b2ce5a82147116ff595d26beab311b3c94cc655c8e3b234
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / builelib-2.3.5-py3-none-any.whl

Download URL builelib-2.3.5-py3-none-any.whl
Size 2.7 MB
Tags Python 3
SHA-256 checksum
How to use checksums
96e4626bd273045383d570b674f627a997ddcab668b68b26ade9ac7ae26c13c5
BLAKE2b-256 checksum
How to use checksums
eb0fb2556fb83ba617dbb2c3c1839cd1207136fd33c6c521dd853c133e1e5160
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Security for builelib 2.3.5

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.

Select from 2 files

Attestation for builelib-2.3.5.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 Nov 24, 2026.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page