If I'm working on a project, ideally I would want import myproject to reference the project's files (rather than any installed version of myproject).
If I start ipython from my project directory, this works. I believe that's because ipython maps my current path and so resolves the package locally.
But this doesn't seem to with ipykernel. Is this something people have encountered?
Alternatively let me know if this is an issue with ipykernel rather than hydrogen.
Thanks!
Hydrogen starts the Kernel in the directory of the current file. So as long as you start the kernel in the root directory of your project this should work.
You can check in which directory the kernel was started by executing !pwd in Hydrogen or IPython.
start the kernel in the root directory of your project
@lgeiger how would you do this?
Scripts cmd-i runs in the project root while Hydrogen runs in the directory of the actual file
@buyology https://github.com/nteract/hydrogen/pull/574 This can help, when I'll implement it :)
@slavaGanzin sounds good, guess I'll have to patch it myself in the meantime
actually @slavaGanzin wouldn't it be relevant to submit the project path-patch in a separate PR?
I cannot see why this shouldn't be the default behaviour especially with lots of ppl coming from Script and using this with the python kernel which makes imports a hassle out of the box
start the kernel in the root directory of your project
@lgeiger how would you do this?
You can do this by starting the kernel in any python file that is in the root directory of your project.
@buyology Please feel free to submit a PR changing this behavior. That would be cool 馃帀
I personally like to start the kernel in the current file but I see that this becomes tedious when working in a bigger project. It's probably best to change that.
Most helpful comment
actually @slavaGanzin wouldn't it be relevant to submit the
project path-patch in a separate PR?I cannot see why this shouldn't be the default behaviour especially with lots of ppl coming from
Scriptand using this with thepythonkernel which makes imports a hassle out of the box