Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't have subfolders for Python #12

Closed
DavidLeoni opened this issue Aug 12, 2018 · 0 comments
Closed

can't have subfolders for Python #12

DavidLeoni opened this issue Aug 12, 2018 · 0 comments

Comments

@DavidLeoni
Copy link
Owner

DavidLeoni commented Aug 12, 2018

Can't have notebooks in subfolders, as to import jupman module

Possible solutions:

a. add stuff like sys.path.append('../') to all files
b. using symlinks to link parent algolab
c. add some new default kernel that includes the paths I want
d. use Jupyter magic like %run ../../lib.py

all solutions which I don't quite like

See also

Attempts with d. Jupyter magics

I tried putting this:

  %run -i ../../jupman
  jupman_init()

Passing parameters like

--toc

and

--root=../../

Some thoughts:

  • Tried static classes but thought they might look confusing to users
  • Since %run executes the script, to prevent namespace pollution all functions start with 'jupman_'
  • Also note that with %run, last command output is not shown in Jupyter, for that you have to explictly call jupman_init() function in Jupyter
  • tried importing .ipynb, but discoverd it is not possible to pass parameters

Decision: sys.path.append

Finally adopted this, it's less weird and just works

  import sys
  sys.path.append('../)
  import jupman
  jupman.init()
DavidLeoni added a commit that referenced this issue Aug 12, 2018
- Prepended all functions in jupman.py with `jupman_`
- Fixed sphinx and tornado versions in requirements:
    sphinx==1.7.6
    +tornado=4.5.3

- Replaced previous init code at beginning of notebooks. Now use this (see discussion in #12):
    %run -i ../../jupman
    jupman_init()
DavidLeoni added a commit that referenced this issue Aug 12, 2018
- Prepended all functions in jupman.py with `jupman_`
- Fixed sphinx and tornado versions in requirements:
    sphinx==1.7.6
    +tornado=4.5.3

- Replaced previous init code at beginning of notebooks. Now use this (see discussion in #12):
    %run -i ../../jupman
    jupman_init()
DavidLeoni added a commit that referenced this issue Aug 26, 2018
- reverted to old jupman.init method for #12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant