Module: IRuby::Jupyter
- Defined in:
- lib/iruby/jupyter.rb
Class Method Summary collapse
-
.default_data_dir ⇒ Object
User’s default kernelspec directory is described here: docs.jupyter.org/en/latest/use/jupyter-directories.html.
- .kernelspec_dir(data_dir = nil) ⇒ Object
Class Method Details
.default_data_dir ⇒ Object
User’s default kernelspec directory is described here:
https://docs.jupyter.org/en/latest/use/jupyter-directories.html
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/iruby/jupyter.rb', line 6 def default_data_dir data_dir = ENV["JUPYTER_DATA_DIR"] return data_dir if data_dir case when windows? appdata = windows_user_appdata if !appdata.empty? File.join(appdata, 'jupyter') else jupyter_config_dir = ENV.fetch('JUPYTER_CONFIG_DIR', File.('~/.jupyter')) File.join(jupyter_config_dir, 'data') end when apple? File.('~/Library/Jupyter') else xdg_data_home = ENV.fetch('XDG_DATA_HOME', '') data_home = xdg_data_home[0] ? xdg_data_home : File.('~/.local/share') File.join(data_home, 'jupyter') end end |
.kernelspec_dir(data_dir = nil) ⇒ Object
28 29 30 31 |
# File 'lib/iruby/jupyter.rb', line 28 def kernelspec_dir(data_dir=nil) data_dir ||= default_data_dir File.join(data_dir, 'kernels') end |