Clean up resources and upgrade dependencies#22
Conversation
The main thing to "fix" was the idiotic addition of "validation" to the OSW that kills runs that will work fine.
jasondegraw
left a comment
There was a problem hiding this comment.
Walkthrough of the changes.
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
All of the OSMs have been updated with the OpenStudio CLI, these are the original 3.7 models.
There was a problem hiding this comment.
All of the plugin-related Python code has been moved to the plugins directory.
| import dataclasses | ||
| from typing import Dict, Union | ||
|
|
||
| @dataclasses.dataclass |
There was a problem hiding this comment.
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.
| @@ -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 | |||
There was a problem hiding this comment.
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.
| output_steps.extend([el.to_dict() for el in self.steps]) | ||
| energyplus_measures = [] | ||
| reporting_measures = [] | ||
| for step in self.steps: |
There was a problem hiding this comment.
This sorting is a bit of a hack and should probably be done better, but it is good enough for now.
| @@ -49,6 +49,7 @@ stor4build = "stor4build.cli:s4b" | |||
| path = "src/stor4build/__about__.py" | |||
|
|
|||
| [tool.hatch.envs.default] | |||
| python = "3.12" | |||
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Do we want this to be 3.8 so it aligns with the python that E+ is using?
bonnema
left a comment
There was a problem hiding this comment.
Looks good to me, really only one comment that might need a reply.
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:
hatchto manage the Python version. This closes The current code is locked into an old Python version #21resourcesdirectory and puts all the plugins in apluginsdirectory, closing Resources directory cleanup #8docsdirectory, closing Demonstrate and document the demo plugin #5The 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.8branch 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:
Also note that the name of the branch really should have been
openstudio-coalition-1-11, but I thought it was too long.