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

Question: Is it possible to preload some ruby script when initializing kernel? #355

Open
simpl1g opened this issue Nov 11, 2024 · 2 comments

Comments

@simpl1g
Copy link
Contributor

simpl1g commented Nov 11, 2024

We have script with some useful methods/settings to work with in notebooks, but we manually doing require in each notebook, is it possible to load it automatically when kernel is starting? Maybe so hooks available?

@rstammer
Copy link
Contributor

I think what you need here is to write your own specialized Jupypter notebook kernel based on the iruby kernel, kinda an extension of the default iruby kernel. That sounds more monstrous as it is in the end, I think, as the "definition" of a kernel is basically a JSON config.

I cannot explain it completely, but maybe here's a hint how to approach it: In the project Jupyter on Rails there is logic that creates a special kernel in between that loads an entire Rails application.

In the same fashion you should be able to construct a kernel file that loads the files you need as your custom kernel. Maybe this rake task is a good starting point for further research.

Good luck!

@simpl1g
Copy link
Contributor Author

simpl1g commented Nov 11, 2024

@rstammer Thanks! yep, I already looked how Jupyter on Rails does this and decided to ask if it possible to do without json manipulations :)

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