Jupyter Notebook extension - %%stan magic


#1

I have created a very basic %%stan magic extension to maintain the stan worklow within jupyter notebook . Once a PR for codemirror stan mode gets through (syntax highlighting/autocomplete) could be enabled.

Install: pip install git+https://github.com/Arvinds-ds/stanmagic.git
Extension page: https://github.com/Arvinds-ds/stanmagic
Sample notebook: https://github.com/Arvinds-ds/stanmagic/blob/master/StanMagic-Help.ipynb

Its very preliminary and more of a hacked POC but some may find it useful as I have during the past week.


#2

Have also created a basic notebook extension to do automatic syntax highlighting for %%stan code cells

https://github.com/Arvinds-ds/stan_code_helper.git

https://github.com/Arvinds-ds/stan_code_helper/raw/master/stan_code_helper.png


#3

Hi, I could install and enable it. But failed to load it.

jupyter nbextension list

shows

  Known nbextensions:
  config dir: /Users/ahartikainen/.jupyter/nbconfig
    notebook section
      stan_code_helper/main  enabled 
      - Validating: OK
  config dir: /Users/ahartikainen/miniconda2/envs/py36/etc/jupyter/nbconfig
    notebook section
      jupyter-js-widgets/extension  enabled 
      - Validating: OK
      jupyter-vega/index  enabled 
      - Validating: OK

So I guess I have something wrong with my jupyter / ipython? Any ideas.


#4

What is the error you are getting?. Your extension log looks ok to me. You need to install the Stanmagic extension first. stanmagic installs the extension for saving/compile checking stan code in Jupyter notebooks. stan_helper_code is some javascript code that enables syntax highlighting. It is an optional extension that requires stanmagic. I have got a couple of queries on this. I have updated the README to highlight this requirement.


#5
ModuleNotFoundError

#6

I just edited my reply above…


#7

Great, it works. I forgot to install stanmagic.


#8

Thanks for all the feedback. Didn’t realize there were many pystan users!. Thanks to @ahartikainen for suggesting improvements. I have updated the stanmagic package (https://github.com/Arvinds-ds/stanmagic.git) with few of your requests including syntax colored HTML formatting of stan code output using pygments.


#9

The more people get involved writing cool new features, the more PyStan users we’ll have!

So, thanks!