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

Include notebooks from outside the root directory #170

Closed
Olllom opened this issue Mar 15, 2018 · 5 comments
Closed

Include notebooks from outside the root directory #170

Olllom opened this issue Mar 15, 2018 · 5 comments

Comments

@Olllom
Copy link

Olllom commented Mar 15, 2018

I have a directory tree like

my_project
    |- docs
         |- conf.py
         |- index.rst
         |- ... some notebooks ...
    |- examples
         |- ... some notebooks ...
    |- code

Is there a straightforward way to include the example notebooks into the toctree of my index.rst without copying them over to docs?

@Olllom
Copy link
Author

Olllom commented Mar 15, 2018

At the moment, I am using a workaround in my conf.py.

print("Copy example notebooks into docs/_examples")

def all_but_ipynb(dir, contents):
    result = []
    for c in contents:
        if os.path.isfile(os.path.join(dir,c)) and (not c.endswith(".ipynb")):
            result += [c]
    return result


shutil.rmtree(os.path.join(project_root, "docs/_examples"), ignore_errors=True)
shutil.copytree(os.path.join(project_root, "examples"),
                os.path.join(project_root, "docs/_examples"),
                ignore=all_but_ipynb)

... this works, but does not seem quite right.

@mgeier
Copy link
Member

mgeier commented Mar 15, 2018

This is not directly supported in nbsphinx, see discussions in #33.
I've actually suggested your work-around in #33 (comment).

As an alternative, you can try https://github.com/vidartf/nbsphinx-include

My favorite option is indeed moving the notebooks to the docs/ folder and creating a symbolic link back to wherever else they should appear.
Note, however, that it doesn't work in the other direction yet, see #49.

If you have another idea how to handle this, I'm open for suggestions!

@Olllom
Copy link
Author

Olllom commented Mar 16, 2018

Thank you.
I will stick with the workaround mentioned above.

@Olllom Olllom closed this as completed Mar 16, 2018
redeboer added a commit to ComPWA/pycompwa that referenced this issue Mar 31, 2020
* Closes #7
* Closes #32
* Closes #70
* Closes #72


* docs: reorganise notebooks into workflow steps

* docs: add previous/next buttons on top as well

* chore: remove dalitz fit script

* docs: rewrite workflow notebooks

* docs: fix cross-references

* docs: add download buttons for each notebook

* docs: set correct notebook cell types

* docs: switch to nbsphinx instead of nbconvert

Examples had to be moved and but are kept in the main directory with a
symlink
spatialaudio/nbsphinx#170

* docs: add copy button

* docs: add trick to execute cells on local build

* docs: add download buttons for each notebook

* docs: reduce bins in Dalitz plot

* docs: do not copy rst source files to build

* build: fix setup install_requires

* docs: remove copyright from website

* docs: fix links to download notebook

* docs: fix square value in Dalitz plots

* docs: fix nbsphinx_execute switch

* docs: move examples back to main directory

* docs: rename examples to usage

* docs: change maintainer email

* docs: fix latex rendering \gamma

* docs: add more API links and wrap notebook cells

* docs: correct typos

Implement suggestions from #74

* docs: implement new description expert system

Implement suggestion from #74

* docs: fix typo
@Vital-Fernandez
Copy link

Hello @Olllom , @kolibril13. At the present day you still recommend copying the files?

@kolibril13
Copy link
Contributor

Currently, I am mostly using JupyterLite builds to publish my notebooks.
I copy extra content (e.g. readme files) via github actions into the right folder.
https://github.com/widgetti/ipyreact/blob/a86b6d9e5f5b4e1501722bcd1ca3e08dcb025368/.github/workflows/deploy.yml#L24-L27
Hope that helps!

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

4 participants