Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Extensible PythonPlugin:SearchPaths #8195

Merged
merged 6 commits into from
Aug 14, 2020
Merged

Conversation

mitchute
Copy link
Collaborator

Pull Request Author

Add to this list or remove from it as applicable. This is a simple templated set of guidelines.

  • Title of PR should be user-synopsis style (clearly understandable in a standalone changelog context)
  • Label the PR with at least one of: Defect, Refactoring, NewFeature, Performance, and/or DoNoPublish
  • Pull requests that impact EnergyPlus code must also include unit tests to cover enhancement or defect repair
  • Author should provide a "walkthrough" of relevant code changes using a GitHub code review comment process
  • If any diffs are expected, author must demonstrate they are justified using plots and descriptions
  • If changes fix a defect, the fix should be demonstrated in plots and descriptions
  • If any defect files are updated to a more recent version, upload new versions here or on DevSupport
  • If IDD requires transition, transition source, rules, ExpandObjects, and IDFs must be updated, and add IDDChange label
  • If structural output changes, add to output rules file and add OutputChange label
  • If adding/removing any LaTeX docs or figures, update that document's CMakeLists file dependencies

Reviewer

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • If branch is behind develop, merge develop and build locally to check for side effects of the merge
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified
  • Check that performance is not impacted (CI Linux results include performance check)
  • Run Unit Test(s) locally
  • Check any new function arguments for performance impacts
  • Verify IDF naming conventions and styles, memos and notes and defaults
  • If new idf included, locally check the err file and other outputs

@mitchute mitchute added the IDDChange Code changes impact the IDD file (cannot be merged after IO freeze) label Aug 11, 2020
@mitchute mitchute added this to the EnergyPlus 9.4.0 milestone Aug 11, 2020
@mitchute mitchute self-assigned this Aug 11, 2020
@mitchute mitchute added the NewFeature Includes code to add a new feature to EnergyPlus label Aug 12, 2020
Copy link
Member

@Myoldmopar Myoldmopar left a comment

Choose a reason for hiding this comment

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

Stray debugging line was left in, otherwise this is good to go in.

@@ -108583,6 +108583,7 @@ PythonPlugin:SearchPaths,
\memo that point to libraries of plugin scripts.
\unique-object
\min-fields 1
\extensible:1
Copy link
Member

Choose a reason for hiding this comment

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

Marked as extensible ✔️

@@ -108605,6 +108606,7 @@ PythonPlugin:SearchPaths,
\default Yes
A4, \field Search Path 1
\type alpha
\begin-extensible
Copy link
Member

Choose a reason for hiding this comment

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

Begins extensible on the first search path ✔️

A12,\field Search Path 9
\type alpha
\retaincase
A13;\field Search Path 10
Copy link
Member

Choose a reason for hiding this comment

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

Adds a few extra paths in the IDD, no problem.

@@ -122,6 +122,7 @@ def isInt(s):
'AirLoopHVAC:Splitter': 'nodes',
'AirLoopHVAC:DedicatedOutdoorAirSystem': 'airloophvacs',
'PythonPlugin:Variables': 'global_py_vars',
'PythonPlugin:SearchPaths': 'py_search_paths',
Copy link
Member

Choose a reason for hiding this comment

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

Names it py_search_paths for the input processor ✔️

@@ -62,6 +62,8 @@
#include <EnergyPlus/PluginManager.hh>
#include <EnergyPlus/UtilityRoutines.hh>

#include <nlohmann/json.hpp>
Copy link
Member

Choose a reason for hiding this comment

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

Includes the header to get access to the proper exception. ✔️

workingDirFlagUC = EnergyPlus::UtilityRoutines::MakeUPPERCase(fields.at("add_current_working_directory_to_search_path"));
} catch (nlohmann::json::out_of_range &e) {
// defaulted to YES
}
Copy link
Member

Choose a reason for hiding this comment

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

Good fix here, if it was blank that would've been problematic.

if (fields.find("search_path_5") != fields.end()) {
PluginManager::addToPythonPath(PluginManager::sanitizedPath(fields.at("search_path_5")), true);
try {
auto const vars = fields.at("py_search_paths");
Copy link
Member

Choose a reason for hiding this comment

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

This lookup is OK since we are inside the try block.

auto const vars = fields.at("py_search_paths");
for (const auto &var : vars) {
try {
std::cout << var.at("search_path");
Copy link
Member

Choose a reason for hiding this comment

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

Probably need to remove this though.

@@ -1388,6 +1399,8 @@ namespace PluginManagement {
#if LINK_WITH_PYTHON == 1
void PluginManager::addToPythonPath(const std::string &path, bool userDefinedPath)
{
if (path.empty()) return;
Copy link
Member

Choose a reason for hiding this comment

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

And here we don't try to add a blank path to the Python search path. ✔️

@mitchute
Copy link
Collaborator Author

Sorry about that, should be good now. Why do something in 1 commit when you can spread it out over 10...

@Myoldmopar
Copy link
Member

Pulled locally to confirm, everything builds and runs fine. I'm going to merge this IDD change now. Thanks @mitchute

@Myoldmopar Myoldmopar merged commit 5bf36f3 into develop Aug 14, 2020
@Myoldmopar Myoldmopar deleted the extensible_searchpaths branch August 14, 2020 15:30
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
IDDChange Code changes impact the IDD file (cannot be merged after IO freeze) NewFeature Includes code to add a new feature to EnergyPlus
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants