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

Order of cells and exporting Codepod projects #203

Closed
forrestbao opened this issue Jan 7, 2023 · 1 comment
Closed

Order of cells and exporting Codepod projects #203

forrestbao opened this issue Jan 7, 2023 · 1 comment

Comments

@forrestbao
Copy link
Collaborator

TL;DR: We need to provide users a means to distinguish cell types and chain/order cells before well-defined exporting from Codepod to .py scripts or Jupyter notebook.

In a CodePod project, code cells do not have orders. So when exporting them to conventional files or Jupyter notebooks, determining the order is a problem.

If a CodePod project has only function/class definitions, then it is very easy because order does not matter. Just export them into one big file or, if there are scopes, to different folders and files. Since scopes are hierarchical, the tree structure of folders and files is enough.

But things become tricky when there are variable definitions, statements, and expressions -- order matters to them. Let's call them "discrete elements" and the function/class definitions as "ICs".

  1. Some discrete elements, like testing code, should NOT be executed when a scope is called. They are like code under if __name__=="__main__". So we need to give users a way to label such code cells and then either discard them or put them under if __name__=="__main__".
  2. The hard part is the rest of them. Order matters. Not only between discrete elements, but also between discrete elements and ICs. Unless we provide a way for users to specify their execution order, the data dependency may be messed up and the code may become non-executable.

So, how to specify the order? I think we can allow uses to label an order number with in the scope. Chain cells using arrows is also good idea. But i am afraid they will look too messy. I think we should implement both.

@forrestbao
Copy link
Collaborator Author

Current solution is #343

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

No branches or pull requests

1 participant