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

Adding help info to nodes + simplifying run definition #2

Open
AlexandreHutton opened this issue Jul 26, 2024 · 0 comments
Open

Adding help info to nodes + simplifying run definition #2

AlexandreHutton opened this issue Jul 26, 2024 · 0 comments
Labels
enhancement New feature or request high priority

Comments

@AlexandreHutton
Copy link
Member

Currently, PSCS doesn't relay information about what the node does. For nodes that rely on existing packages, each node will usually call only one function. We should take the docstring from that function and assign it to the node.
Additionally, we could store the function when the node is initialized, then get the docstring in the .store_as_parameters call.

We would be able to remove the run() definition from most nodes and docstrings would be connected to the underlying package. Something like:

class PipelineNode():
    self.function = None
    def run(self):
        data = self.input_data
        self.function(*data, **self.parameters)
        self._terminate(data)

class ExampleNode(PipelineNode):
    self.function = function_to_run
   def __init__(self, params):
        self.store_vars_as_parameters(**vars())
        return

# modify store_vars_as_parameters
self = kwargs["self"]
if self.function is not None and self.__doc__ is not None:
    self.__doc__ = self.function.__doc__
    self._param_doc_ = parse_doc(self.__doc__)   # there are doc parsers; might be able to get parameter-specific help this way for properly-formatted docstring  
@AlexandreHutton AlexandreHutton added enhancement New feature or request high priority labels Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request high priority
Projects
None yet
Development

No branches or pull requests

1 participant