-
Notifications
You must be signed in to change notification settings - Fork 40
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
allow for csp nodes and graphs to be defined in repl #178
base: main
Are you sure you want to change the base?
Conversation
# if its a def name_of_function(... | ||
if search_pattern.match(line): | ||
# reassemble function | ||
for i in range(starting_index_of_function, current_interpreter_history + 1): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be a little smarter here and go block-by-block to ensure we only grab 1
I tried 3 different ways to add tests:
None worked nicely. |
would using dill.source.getsource() simplify the changes needed on our end? |
i had hoped so too but there appears to be a bug in dill getsource (which i tried to repro and fix). I can try again to repro/fix it but:
The bug:
I believe it is a fencepost error and omitting the last line. |
Signed-off-by: Tim Paine <[email protected]>
…ames Signed-off-by: Tim Paine <[email protected]>
My patch to dill has been merged upstream, we can either require users that want this functionality to have a very latest dill, or keep the code in our own repo as the PR does currently. Since defining nodes and graphs in a repl is not super common or practical, I think either option is fine. |
I'm a proponent of getting this working one way or another, as I think it improves the user experience (and maybe also because I try to define nodes in the repl more than most users). I don't have a super strong view about how it's done (i.e. force a relatively new version of dill in the dependencies or include the code in the repo), but I am in favor of having it work "by default", i.e. without users needing to opt-in (i.e. by manually installing dill). @robambalu Which way are you leaning? |
I would go with dill so we dont have to maintain this extra code, as long as we can tell when we're in a case that dill is required and we can then do a version check / raise an exception if its not supported |
That's fine with me, as long as it's super clear to users what they need to do when they encounter the error. Maybe down the road we can include the new-enough dill as part of the requirements, but I agree it's probably too new to do that now. |
Fixes #177 by reassembling the source code from the interpreter history
Needs tests