Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Python script runner api #1282

Merged
merged 8 commits into from
May 23, 2024
Merged

Python script runner api #1282

merged 8 commits into from
May 23, 2024

Conversation

jmthomas
Copy link
Member

Basic implementation done but wanted to discuss the best way to test (not tested currently)

closes #1281

@jmthomas jmthomas requested a review from ryanmelt May 17, 2024 23:19


# Require an additional python file
def load_utility(procedure_name):
Copy link
Member

Choose a reason for hiding this comment

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

load_utility and require_utility need to work differently in Python.

If I require_utility or load_utility I should expect to have new methods to call. (like the collect() utility method from collect.py)

Copy link
Member

Choose a reason for hiding this comment

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

supported not support

@@ -45,8 +45,6 @@ def load_utility(procedure_name):
return False


require_utility = load_utility
Copy link
Member

Choose a reason for hiding this comment

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

This is breaking. There is no harm in supporting both require_utility and load_utility.

# not_cached = require(procedure_name)
pass
else:
raise RuntimeError("load_utility not support outside of Script Runner")
Copy link
Member

Choose a reason for hiding this comment

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

supported not support

@@ -1339,7 +1335,6 @@ def load_utility(procedure_name):


setattr(openc3.script, "load_utility", load_utility)
setattr(openc3.script, "require_utility", load_utility)
Copy link
Member

Choose a reason for hiding this comment

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

This is breaking, don't remove.



# Require an additional python file
def load_utility(procedure_name):
Copy link
Member

Choose a reason for hiding this comment

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

supported not support

def test_load_utility_raises(self):
with self.assertRaisesRegex(
RuntimeError,
"load_utility not support outside of Script Runner",
Copy link
Member

Choose a reason for hiding this comment

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

supported not support

@jmthomas jmthomas merged commit 10c602c into main May 23, 2024
15 checks passed
@jmthomas jmthomas deleted the python_script branch May 23, 2024 04:50
Copy link

Quality Gate Passed Quality Gate passed

Issues
4 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python Scripting API Enhancements
2 participants