Skip to content

Clean up resources and upgrade dependencies#22

Open
jasondegraw wants to merge 7 commits intodevelopfrom
openstudio-1-11
Open

Clean up resources and upgrade dependencies#22
jasondegraw wants to merge 7 commits intodevelopfrom
openstudio-1-11

Conversation

@jasondegraw
Copy link
Copy Markdown
Contributor

@jasondegraw jasondegraw commented May 4, 2026

This is a PR that's needed to happen for a while, and while I generally want to avoid a bunch of unrelated things in a single PR, the need for pretty much everything arose all at once. Python 3.8 is past end of life, so reliance on that is not great. Moving to newer Ubuntu VMs has lead to a bunch of certificate-related complications and failures, so enabling Windows development of as much as possible is really needed. So this PR does the following:

The big caveat here is that the API needs some attention before it will work. That will come in a separate PR. For now, there is now an OpenStudio-3.8 branch where the working version of the API (using Python 3.8 and OpenStudio 3.7) until the API can be updated.

Once this PR goes in, there are two issues that need to be put in:

  • The models need to be properly regenerated.
  • The API needs to be updated for OpenStudio 3.11.

Also note that the name of the branch really should have been openstudio-coalition-1-11, but I thought it was too long.

Copy link
Copy Markdown
Contributor Author

@jasondegraw jasondegraw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Walkthrough of the changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Markdown file documents the basics of what the demo plugin is doing.

args << strg_medium

# create argument for custom site packages
custom_site = OpenStudio::Measure::OSArgument.makeStringArgument(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original code was setting the site packages based on the operating system, which is fine, but if we want more flexibility we need a way to use custom locations. This argument provides a way to pass that information in.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea

strg_medium = runner.getStringArgumentValue('strg_medium', usr_args)
custom_site_packages = runner.getStringArgumentValue('custom_site_packages', usr_args).strip()

if custom_site_packages.length == 0
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If nothing is passed in, it falls back to the old locations with the Python 3.8 hardcode.

)
end
no.setString(5, File.join(p, 'resources'))
no.setString(4, custom_site_packages)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's where the custom location is added into the model, then the next two lines take care of the thermal tank code and then any controls that might be needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the OSMs have been updated with the OpenStudio CLI, these are the original 3.7 models.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the plugin-related Python code has been moved to the plugins directory.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the organization

Comment thread src/stor4build/system.py
import dataclasses
from typing import Dict, Union

@dataclasses.dataclass
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point, a "validation" was introduced into OpenStudio that rejects schema-acceptable workflow files, so I had to add some order to the measures.

Comment thread src/stor4build/icetank.py
@@ -50,9 +50,17 @@ def __init__(self, name, pre_steps=None, post_steps=None, **kwargs):
else:
self.charge_temp = freezing_temp[self.storage_medium] + charge_temp_delta[self.store_ice]
self.sizing = kwargs.get('sizing', {})
# The plug-in needs some packages, let's find where they SHOULD be
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code uses the Python site package to work out where the site-packages directory is. I'm currently using the presence of numpy as a test, which is a little lame but serviceable.

Comment thread src/stor4build/system.py
output_steps.extend([el.to_dict() for el in self.steps])
energyplus_measures = []
reporting_measures = []
for step in self.steps:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sorting is a bit of a hack and should probably be done better, but it is good enough for now.

Comment thread pyproject.toml
@@ -49,6 +49,7 @@ stor4build = "stor4build.cli:s4b"
path = "src/stor4build/__about__.py"

[tool.hatch.envs.default]
python = "3.12"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the where the specification of the Python version we need is. When transitioning to this, I needed to rebuild the virtual environments from scratch, just updating didn't seem to work.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want this to be 3.8 so it aligns with the python that E+ is using?

@jasondegraw jasondegraw marked this pull request as ready for review May 5, 2026 00:14
@jasondegraw jasondegraw requested a review from bonnema May 5, 2026 00:14
@jasondegraw jasondegraw added enhancement New feature or request priority: high Requires attention labels May 5, 2026
Copy link
Copy Markdown
Contributor

@bonnema bonnema left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, really only one comment that might need a reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority: high Requires attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The current code is locked into an old Python version

2 participants