Type-safe Pydantic models for all EnergyPlus IDF objects
Project description
idfpy
Type-safe Pydantic models for all EnergyPlus IDF object types, plus IDF file read/write and simulation execution.
Auto-generated from Energy+.schema.epJSON version 25.2.0.
Features
- 858 object types as Pydantic v2 models with full validation
- 275 reference types with cross-object validation
- Forward navigation —
surface.zoneresolves a reference field to the target object - Reverse navigation —
zone.referencing("Lights")finds all objects that reference a given object - Reference validation —
idf.validate()batch-checks all cross-object references for existence and type compatibility - Case-insensitive Literal field matching (EnergyPlus IDF is case-insensitive)
- Extensible field support (vertices, schedule data, etc.)
- IDF read/write with positional field ordering
- epJSON read/write with auto-detection by file extension
to_dict()/from_dict()for in-memory dict conversion (ideal for LLM tool calls)- EnergyPlus simulation execution with ExpandObjects support
- Accepts both
snake_caseand original EnergyPlus schema key names
Installation
pip install idfpy
Quick Start
from pathlib import Path
from idfpy import IDF
from idfpy.models.simulation import Version, Building
from idfpy.models.thermal_zones import Zone
# Create an IDF
idf = IDF()
idf.add(Version())
idf.add(Building(name='MyBuilding', north_axis=0.0))
idf.add(Zone(name='Zone1'))
# Save as IDF
idf.save(Path('output.idf'))
# Save as epJSON
idf.save(Path('output.epjson'), output_type='epjson')
# Load (auto-detects format by extension)
idf = IDF.load(Path('existing.idf')) # IDF format
idf = IDF.load(Path('existing.epjson')) # epJSON format
# Run simulation
idf.run(
idf_path=Path('model.idf'),
weather_path=Path('weather.epw'),
output_dir=Path('results/'),
)
In-memory dict conversion
from pathlib import Path
from idfpy import IDF
idf = IDF.load(Path('model.idf'))
# IDF → dict (epJSON structure)
data = idf.to_dict()
# {
# "Building": {"MyBuilding": {"north_axis": 0.0, "terrain": "Suburbs"}},
# "Zone": {"Zone1": {"direction_of_relative_north": 0.0}},
# ...
# }
# dict → IDF
idf = IDF.from_dict(data)
Object navigation
Every reference field generates a @property for forward navigation. Reverse navigation is available via referencing().
from pathlib import Path
from idfpy import IDF
idf = IDF.load(Path('model.idf'))
# Forward navigation — resolve reference to target object
surface = idf.get('BuildingSurface:Detailed', 'Wall1')
surface.zone_name # "Zone1" (raw string, always works)
surface.zone # Zone object (resolved via IDF)
surface.construction # Construction object
# Reverse navigation — find all objects referencing a given object
zone = idf.get('Zone', 'Zone1')
zone.referencing('BuildingSurface:Detailed') # → [Wall1, Wall2, ...]
zone.referencing('Lights') # → [OfficeLights, ...]
# Chained navigation
zone.referencing('BuildingSurface:Detailed')[0].construction
Reference validation
from idfpy import IDF, RefValidationError
idf = IDF.load(Path('model.idf'))
# Batch check all cross-object references
errors = idf.validate()
for e in errors:
print(e)
# [missing] Lights/OffLights.schedule_name: "BadSched" not found in any of [ScheduleNames]
# Or raise on first broken reference set
try:
idf.validate_or_raise()
except RefValidationError as exc:
print(f"{len(exc.errors)} broken reference(s)")
Container mutation
idf.remove('Zone', 'Zone1') # unbinds + unregisters references
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 idfpy-25.2.0.post2.tar.gz.
File metadata
- Download URL: idfpy-25.2.0.post2.tar.gz
- Upload date:
- Size: 559.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc7c32f23f86965d32fc26247d6afae4996f96b425156d833aae537252fbfe3b
|
|
| MD5 |
e9e0ceb0fa41b883c402d56e0183b17e
|
|
| BLAKE2b-256 |
6ca819b5cd471a6fcaf02382a5133497867bf7e2b238df940a17d75cc8068ecd
|
Provenance
The following attestation bundles were made for idfpy-25.2.0.post2.tar.gz:
Publisher:
publish.yml on ITOTI-Y/idfpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
idfpy-25.2.0.post2.tar.gz -
Subject digest:
fc7c32f23f86965d32fc26247d6afae4996f96b425156d833aae537252fbfe3b - Sigstore transparency entry: 1194601258
- Sigstore integration time:
-
Permalink:
ITOTI-Y/idfpy@dd0f660949684fc6546b5fae4fe0cdc9643c735d -
Branch / Tag:
refs/heads/master - Owner: https://github.com/ITOTI-Y
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dd0f660949684fc6546b5fae4fe0cdc9643c735d -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file idfpy-25.2.0.post2-py3-none-any.whl.
File metadata
- Download URL: idfpy-25.2.0.post2-py3-none-any.whl
- Upload date:
- Size: 578.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45c543ab7d900a7b50b51beb4483a065c968c38c290dcfa6ecd4cfeee59350a3
|
|
| MD5 |
2446bfcd820c6a1cebecea280ef15d7a
|
|
| BLAKE2b-256 |
04cd2eeeefc86c822772c622d0d96a2f64fe53138289d8088c3d969b259b8a78
|
Provenance
The following attestation bundles were made for idfpy-25.2.0.post2-py3-none-any.whl:
Publisher:
publish.yml on ITOTI-Y/idfpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
idfpy-25.2.0.post2-py3-none-any.whl -
Subject digest:
45c543ab7d900a7b50b51beb4483a065c968c38c290dcfa6ecd4cfeee59350a3 - Sigstore transparency entry: 1194601269
- Sigstore integration time:
-
Permalink:
ITOTI-Y/idfpy@dd0f660949684fc6546b5fae4fe0cdc9643c735d -
Branch / Tag:
refs/heads/master - Owner: https://github.com/ITOTI-Y
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dd0f660949684fc6546b5fae4fe0cdc9643c735d -
Trigger Event:
workflow_dispatch
-
Statement type: