I think the best way to start playing with this is to build it as an
extension, and use notebook metadata that tracks separate file should
be pointed to by a given cell. I completely agree this is an good
usage case.

On Sat, Jun 3, 2017 at 11:19 AM, Utkonos <[email protected]> wrote:
> I have been running into the following problem with regards to developing in
> Jupyter and then deploying the code elsewhere. The code as deployed may have
> a bug or change that needs to occur, and then the code from the cell where
> it was located in the Jupyter notebook is now different and out of sync. I
> would like to know how to keep code in a cell synchronized with code outside
> in another file. I found the following question on StackOverflow that
> pertains to this problem exactly:
> https://stackoverflow.com/questions/38770604/synchronizing-code-between-jupyter-ipython-notebook-script-and-class-methods
>
> I will try this method of workflow, but I am curious whether there is a
> better mousetrap out there.
>
> Here is my alternative, and I'd like to know the feasibility of it and
> whether it's a good idea or not:
>
> There are multiple types of cell in Jupyter, and they behave differently. I
> am proposing a new type of cell called "Linked Snippet". A linked snippet
> cell would initially have a start and end line number and a file path. As
> long as the user the notebook is running as has write access the file path,
> the lines of code would be pulled into the cell. This code would be editable
> in jupyter, but would have the option of saving the contents of the cell and
> replacing the code between the two line numbers in the external file. This
> means no cells can overlap line numbers, and this would need to be enforced
> properly in Jupyter. Ideally, this would be bi-directional, and if the code
> in the external file changed, Jupyter would offer the user a chance to
> reload the cell before running. It also may need to change the line numbers
> that are syncronized at this point to make sure that the expected code is
> loaded into the cell.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Project Jupyter" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jupyter/ae6819f5-f422-43aa-b7bf-0ba63bc523cd%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Brian E. Granger
Associate Professor of Physics and Data Science
Cal Poly State University, San Luis Obispo
@ellisonbg on Twitter and GitHub
[email protected] and [email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/CAH4pYpTGeiAUkKbSE6efow10_2wjZCpt7%2BS1qof4-GFgT%2Bo8vg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to