Skip to main content

codecov PyPI License Test and Lint

idf2yaml is a package that converts IDF files for the EnergyPlus simulation software to YAML format and vice versa. This package allows users to easily convert between these two formats, enabling to work with EnergyPlus models with yaml tooling.

idf2yaml is built upon the libraries eppy🔗 and ruamel.yaml🔗.

The package consists of two functions, idf2yaml and yaml2idf, which convert IDF files to YAML format and YAML files (if, of course, appropriately populated) to IDF format, respectively.

The following quickstart script shows how to use the package:

from idf2yaml import idf2yaml, yaml2idf, DEFAULT_IDD

# Convert IDF to YAML
yaml_string = idf2yaml(
    "example.idf",              # path to the IDF file
    idd=DEFAULT_IDD,            # path to the IDD file
    skip_empty=True,            # if True, attributes not explicitly set in the IDF will not appear
    output_path="output.yaml"   # can be None if only the string is needed
)

# Convert YAML file back to IDF
idf_string_file = yaml2idf(
    "output.yaml",              # path to the yaml file
    idd=DEFAULT_IDD,            # path to the IDD file
    output_path="output.idf",   # can be None if only the string is needed
)

# Convert YAML string back to IDF
idf_string_string = yaml2idf(
    yaml_string,                # string representing the yaml content
    idd=DEFAULT_IDD,            # path to the IDD file
    output_path="output.idf",   # can be None if only the string is needed
)

# The result is the same
assert idf_string_file == idf_string_string

The tool has a command line entry point as well.

python -m idf2yaml --help

The conversion from IDF to YAML includes useful annotations for the attributes, such as

  • Physical units
  • Default values
  • Numeric range (min->max)
  • Set of possible choices for categoricals [opt1|opt2|opt3]

These are derived from the EnergyPlus IDD (Input Data Dictionary) file, which works as a specification of the IDF file format and is used throughout the package for decoding and emission.

[!NOTE]
The parsing and emission performed by this package is always just as good as the IDD file. DEFAULT_IDD is directly derived from the official EnergyPlus repo and should work fine for the most recent versions of EnergyPlus.

[!TIP] For advanced users: you can customize the yaml annotation by monkey patching the make_help_string function, which is exposed as well.

Metadata

Release files for idf2yaml 0.1.1

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

Source distribution (sdist)

Source distribution for idf2yaml 0.1.1
File Size Uploaded
idf2yaml-0.1.1.tar.gz 10.0 kB Details

Built distribution (wheel)

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

Total release size: 17.3 kB

Release files / idf2yaml-0.1.1.tar.gz

Download URL idf2yaml-0.1.1.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
857ebdf67a1005003629b7a7270dea72faaf43e9942036428dac5e260f188ddc
BLAKE2b-256 checksum
How to use checksums
c6363f7d89bfaab95fb567ae5b70be31a2a1cab696cafa9d158da0ae83bce4ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.3

Release files / idf2yaml-0.1.1-py3-none-any.whl

Download URL idf2yaml-0.1.1-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
839b2d5eed3166543d6d0a2a49c431fcc1bc83a10435482fe430ed9d3f366eca
BLAKE2b-256 checksum
How to use checksums
c9ca2169e2a6e1e99886437394ddbfe1888c9c3dc7438ab920a80e62ce3d4907
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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