top | item 43416631

(no title)

jdaw0 | 11 months ago

i wanted to like marimo, but the best notebook interface i've tried so far is vscode's interactive window [0]. the important thing is that it's a python file first, but you can divide up the code into cells to run in the jupyter kernel either all at once or interactively.

0: https://code.visualstudio.com/docs/python/jupyter-support-py

discuss

order

aaplok|11 months ago

Spyder also has these, possibly for longer than vscode [0]. I don't know who had this idea first but I remember some vim plugins doing that long ago, so maybe the vim community?

[0] https://docs.spyder-ide.org/current/panes/editor.html#code-c...

westurner|11 months ago

Jupytext docs > The percent format: https://github.com/mwouts/jupytext/blob/main/docs/formats-sc... :

  # %% [markdown]
  # Another Markdown cell

  # %%
  # This is a code cell
  class A():
      def one():
          return 1


  # %% Optional title [cell type] key="value"
MyST Markdown has: https://mystmd.org/guide/notebooks-with-markdown :

  ```{code-cell} LANGUAGE
  :key: value

  CODE TO BE EXECUTED
  ```
And :

  ---
  kernelspec:
    name: javascript
    display_name: JavaScript
  ---

  # Another markdown cell

  ```{code-cell} javascript
  // This is a code cell
  console.log("hello javascript kernel");
  ```
But also does not store the outputs in the markdown.

0cf8612b2e1e|11 months ago

This is also where I have landed. Gives you all of your nice IDE tooling alongside the REPL environment. No need for separate notebook aware code formatters/linters/etc. That they version cleanly is just the cherry on top.

darkteflon|11 months ago

Looks very interesting. Could you elaborate on why you prefer this over the .ipynb notebook interface built into VS Code? The doc you linked mentions debugging, but I have found that the VS Code debugger is already fairly well-integrated into .ipynb notebooks. Is it mainly the improved diffing and having a REPL?

jdaw0|11 months ago

my impetus for exploring it was that vim modal editing and keyboard navigation is just really clunky in the notebook integration.

whether or not it's better for you depends on your use case for notebooks — i use them mostly for prototyping and exploratory data analysis so separating the code from the output might be more convenient for me than for you

cantdutchthis|11 months ago

Out of curiosity, does this approach also allow for interactive widgets?

luke-stanley|11 months ago

Yes. Though it is split into a code section and an interactive section, like with Markdown previews. It really is driven by the code cells though.

kylebarron|11 months ago

Agreed, I find this to be a super productive environment, because you get all of vscode's IDE plus the niceties of Jupyter and IPython.

I wrote a small vscode extension that builds upon this to automatically infer code blocks via indentation, so that you don't have to select them manually: [0]

[0]: https://github.com/kylebarron/vscode-jupyter-python