Skip to content

Programmatically update Docstring #47

@ztyree42

Description

@ztyree42

Hi,

I want to use Trace to build an application to let non-engineers optimized code for certain tasks. Ideally I would like to have an f-string in place of the docstring for a number of bundled functions that are methods on classes decorated by @model but of course python requires docstrings be a string literal. I'm REALLY trying to avoid resorting to a templating library for this. Currently I am trying to update the docstring of a number of bundled functions through some combination of bundled_function.description bundled_function.info['doc'] bundled_function._fun.__doc__ but so far no matter what I do I can't see the new docstring in the parameters of either the function node or in the associated optimizers.

Do you all have a suggestion of how I could implement a templated docstring? For reference here's a SUPER minimal example of what I mean:

@bundle some_func(input_data):
f"""input_data is {data_description}. 
You need to {task_description}. 
Make sure you don't {caveats_description}.
"""
    pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions