Metadata-Version: 2.5
Name: canmet-tbd
Version: 3.5.2
Summary: Thermal Bridging & Derating (TBD) for OpenStudio — native Python port of the rd2/tbd Ruby gem
Project-URL: Homepage, https://github.com/rd2/tbd
Project-URL: Source, https://github.com/rd2/tbd
Project-URL: Upstream, https://github.com/rd2/tbd
Author-email: Denis Bourgeois & Dan Macumber <denis@rd2.ca>
License: MIT License
        
        Copyright (c) 2020-2026 Denis Bourgeois & Dan Macumber
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: bridging,derating,energy,openstudio,thermal
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.8
Requires-Dist: jsonschema>=4
Requires-Dist: openstudio
Requires-Dist: oslg==0.4.0
Requires-Dist: osut==0.9.1
Requires-Dist: py-topolys==0.1.0
Provides-Extra: test
Requires-Dist: pytest-cov; extra == 'test'
Requires-Dist: pytest>=7; extra == 'test'
Description-Content-Type: text/markdown

# py-tbd

**Thermal Bridging & Derating (TBD) for OpenStudio — native Python port.**

`py-tbd` is a line-for-line Python port of the [rd2/tbd](https://github.com/rd2/tbd)
Ruby gem. It autodetects major thermal bridges (balconies, parapets, corners, …)
in an OpenStudio model and derates the outside-facing opaque constructions
(walls, roofs, exposed floors) to account for the added heat loss.

This is the **library** (importable as `tbd`). The OpenStudio *measure* wrapper
that ships with the Ruby gem is out of scope for v1.

## Status

Feature-complete port of TBD `3.6.0` (commit `dd6f12f8` — see [`UPSTREAM.md`](UPSTREAM.md)).
All of `psi.rb`, `geo.rb` and `ua.rb` are ported: the `KHI`/`PSI` libraries, the
geometry/topology layer, the UA' reporting, and the full `inputs`/`derate`/
`process`/`exit` engine.

Parity is enforced by golden fixtures generated from the Ruby gem (OpenStudio
3.11.0) and asserted by 150+ tests, including exact `process` parity across all
nine `.osm` fixtures, JSON-override and uprating cases, and the bilingual UA'
report. The one deliverable intentionally left out of v1 is the OpenStudio
Measure wrapper (this is the importable library).

## Install

`py-tbd` depends on the OpenStudio SDK Python bindings and the Python ports of
TBD's dependency gems:

- [`openstudio`](https://pypi.org/project/openstudio/) — OpenStudio SDK bindings
- [`oslg`](https://pypi.org/project/oslg/) — logging (port of the OSlg gem)
- [`osut`](https://pypi.org/project/osut/) — OpenStudio utilities (port of the OSut gem / pyOSut)
- [`py-topolys`](https://github.com/canmet-energy/py-topolys) — 3D topology (port of the Topolys gem)
- `jsonschema` — validates `tbd.json` inputs against `tbd.schema.json`

```bash
python -m venv .venv
.venv/bin/pip install openstudio oslg osut jsonschema \
    "py-topolys @ git+https://github.com/canmet-energy/py-topolys.git"
.venv/bin/pip install -e .
```

> On Debian/Ubuntu Python (PEP 668), if `python -m venv` cannot bootstrap pip,
> create it with `python3 -m venv --without-pip .venv` and bootstrap pip via
> `curl -sS https://bootstrap.pypa.io/get-pip.py | .venv/bin/python`.

## Usage

```python
import openstudio
import tbd

translator = openstudio.osversion.VersionTranslator()
model = translator.loadModel(openstudio.path("model.osm")).get()

argh = {"option": "poor (BETBG)"}
result = tbd.process(model, argh)   # -> {"io": ..., "surfaces": ...}
```

## Tests / parity

Parity with the Ruby gem is enforced by golden reference fixtures generated from
the gem (`tools/gen_golden.rb`) plus a unit test per public method. See the
plan and [`UPSTREAM.md`](UPSTREAM.md).

```bash
.venv/bin/pytest tests/unit    # fast, per-method
.venv/bin/pytest tests/e2e     # end-to-end (ports of the Ruby RSpec suite)
```

## License

MIT — © 2020-2026 Denis Bourgeois & Dan Macumber.
