-
Notifications
You must be signed in to change notification settings - Fork 133
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
Something like iPython profile_default/startup? #1149
Comments
What kind of code is in your environment? Perhaps a naive question, but why can't you refactor this boilerplate code into a module or library that you import at the beginning of your notebook? |
At work it's all sorts of things; database connections, basic things like Consolidating into one helper file / module and then importing might work? I'll test it out, but I don't think I can get an instance of a class by just importing? I think I need to run the file? (much like the startup in ipython) |
You could define your imports in a function and then wrap it from project import boilerplate
app = marimo.App()
app.cell(hide_code=True)(boilerplate) and in boilerplate instantiate your classes etc. This might break on saving in the editor though? |
I'm going to close this in favor of being explicit and importing a module/library at the top of your notebook. That helps with reproducibility/portability of notebooks too. |
Description
I guess this may be completely contrary to the spirit of marimo, but I really miss having things automatically run/imported the way jupyter runs the files in
~/.ipython/profile_default
.Suggested solution
If running some startup script is too obscure (i.e. someone else with the marimo file can't see this hidden set of imports, etc.), maybe there could be a templates or some way to have every new marimo notebook create a new cell based on some other .py file? (maybe even have this cell be hidden somehow if possible, but visible to version control.)
I have a lot of boilerplate code in my environment and I handle this usually with the ipython startup file, I'd rather not have to manually copy /paste it into every marimo notebook.
Alternative
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: