pprzetacznik / IElixir

Jupyter's kernel for Elixir programming language
Apache License 2.0
359 stars 42 forks source link

Allow notebook to resolve starting working directory #52

Closed Virviil closed 5 years ago

Virviil commented 5 years ago

The problem

When the notebook is started, we sometimes need to import files or modules from relative paths from the file. For example:

c "my_helper_module.ex"

# or

Jason.decode!(File.read!("../data.json")

In order to do this, jupyter can be started from the relevant folder. In elixir, we can check the folder name using

iex> cwd
#or
iex> File.cwd

This PR allows kernel to resolve the current working directory properly.

coveralls commented 5 years ago

Coverage Status

Coverage increased (+1.7%) to 52.464% when pulling c8543778a1a759b03117b1b0ebc2e502b98cca94 on Virviil:workdir-fix into 564d3796f12dc37d4d84d9e4d162af5e9f0a5e5e on pprzetacznik:master.

pprzetacznik commented 5 years ago

@Virviil, this is really cool. Could you please also add a small note to the README.md file about this?

Virviil commented 5 years ago

@pprzetacznik I've added notebook-as-example because no need to add this to the readme - it's common behavior for all the other kernels. Can you please check out the failing CI?

Virviil commented 5 years ago

@pprzetacznik CI is fixed 👍

pprzetacznik commented 5 years ago

Thanks! :)