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

Move function definitions to a module #4

Open
janxkoci opened this issue Oct 9, 2021 · 2 comments
Open

Move function definitions to a module #4

janxkoci opened this issue Oct 9, 2021 · 2 comments

Comments

@janxkoci
Copy link

janxkoci commented Oct 9, 2021

I recommend moving definitions of functions from the notebooks into a module (which can be a simple python script file). This will provide the following benefits:

  1. Make the notebooks more clean and readable, as they will mostly contain plots made by calls to functions defined separately.
  2. Make easier to track changes to the function definitions, since it will be in standard python script file(s), rather than embedded inside a notebook. This in turn will facilitate contributions from users that don't know or use Jupyter notebooks.

I mostly use Jupyter notebooks with R, but I use this approach constantly and it works great. I think a good start would be to move all the cells with def statements and module imports into separate functions.py file, which can then be loaded at the top of the notebook.

@colinmegill
Copy link
Member

Yes, I agree. We'd welcome a PR if anyone wants to take this on

@janxkoci
Copy link
Author

I can try later, if nobody else will step up...

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

2 participants