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

Fix order of template paths #1496

Merged
merged 1 commit into from
Jun 7, 2021
Merged

Conversation

m2-farzan
Copy link
Contributor

Fixes #1495.

I just played around and found this fix. I hope other devs can check this with more insight, so that nothing breaks by this patch.

Thanks!

P.S. After this patch, the repro steps described in #1495 gives:

mostafa🐌phi ~ 
$ $VENV/jupyter nbconvert --debug --to=latex --template=my-latex-template my-notebook.ipynb
[NbConvertApp] Searching ['/repro/user-home', '/repro/user-home/.jupyter', '/repro/venv/etc/jupyter', '/usr/local/etc/jupyter', '/etc/jupyter'] for config files
[NbConvertApp] Looking for jupyter_config in /etc/jupyter
[NbConvertApp] Looking for jupyter_config in /usr/local/etc/jupyter
[NbConvertApp] Looking for jupyter_config in /repro/venv/etc/jupyter
[NbConvertApp] Looking for jupyter_config in /repro/user-home/.jupyter
[NbConvertApp] Looking for jupyter_config in /repro/user-home
[NbConvertApp] Looking for jupyter_nbconvert_config in /etc/jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in /usr/local/etc/jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in /repro/venv/etc/jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in /repro/user-home/.jupyter
[NbConvertApp] Looking for jupyter_nbconvert_config in /repro/user-home
[NbConvertApp] Converting notebook my-notebook.ipynb to latex
[NbConvertApp] Notebook name is 'my-notebook'
[NbConvertApp] Template paths:
	/repro/user-home/.local/share/jupyter/nbconvert/templates/my-latex-template 👈 Good.
	/repro/user-home/.local/share/jupyter
	/repro/user-home/.local/share/jupyter/nbconvert/templates
	/repro/user-home/.local/share/jupyter/nbconvert/templates/compatibility
	/repro/venv/share/jupyter
	/repro/venv/share/jupyter/nbconvert/templates
	/repro/venv/share/jupyter/nbconvert/templates/compatibility
	/usr/local/share/jupyter
	/usr/local/share/jupyter/nbconvert/templates
	/usr/local/share/jupyter/nbconvert/templates/compatibility
	/usr/share/jupyter
	/usr/share/jupyter/nbconvert/templates
	/usr/share/jupyter/nbconvert/templates/compatibility
	/repro/user-home/.local/share/jupyter/nbconvert/templates/latex
	/repro/venv/share/jupyter/nbconvert/templates/latex
	/usr/local/share/jupyter/nbconvert/templates/latex
	/usr/share/jupyter/nbconvert/templates/latex
[NbConvertApp] Applying preprocessor: TagRemovePreprocessor
[NbConvertApp] Applying preprocessor: RegexRemovePreprocessor
[NbConvertApp] Applying preprocessor: coalesce_streams
[NbConvertApp] Applying preprocessor: SVG2PDFPreprocessor
[NbConvertApp] Applying preprocessor: LatexPreprocessor
[NbConvertApp] Applying preprocessor: HighlightMagicsPreprocessor
[NbConvertApp] Applying preprocessor: ExtractOutputPreprocessor
[NbConvertApp] Attempting to load template index.tex.j2
[NbConvertApp]     template_paths: /repro/user-home/.local/share/jupyter/nbconvert/templates/my-latex-template:/repro/user-home/.local/share/jupyter:/repro/user-home/.local/share/jupyter/nbconvert/templates:/repro/user-home/.local/share/jupyter/nbconvert/templates/compatibility:/repro/venv/share/jupyter:/repro/venv/share/jupyter/nbconvert/templates:/repro/venv/share/jupyter/nbconvert/templates/compatibility:/usr/local/share/jupyter:/usr/local/share/jupyter/nbconvert/templates:/usr/local/share/jupyter/nbconvert/templates/compatibility:/usr/share/jupyter:/usr/share/jupyter/nbconvert/templates:/usr/share/jupyter/nbconvert/templates/compatibility:/repro/user-home/.local/share/jupyter/nbconvert/templates/latex:/repro/venv/share/jupyter/nbconvert/templates/latex:/usr/local/share/jupyter/nbconvert/templates/latex:/usr/share/jupyter/nbconvert/templates/latex
[NbConvertApp] Support files will be in my-notebook_files/
[NbConvertApp] Making directory my-notebook_files
[NbConvertApp] Writing 13500 bytes to support file my-notebook_files/my-notebook_12_1.png
[NbConvertApp] Making directory my-notebook_files
[NbConvertApp] Writing 13678 bytes to support file my-notebook_files/my-notebook_45_0.png
[NbConvertApp] Making directory my-notebook_files
[NbConvertApp] Writing 12328 bytes to support file my-notebook_files/my-notebook_58_0.png
[NbConvertApp] Making directory my-notebook_files
[NbConvertApp] Writing 13652 bytes to support file my-notebook_files/my-notebook_62_1.png
[NbConvertApp] Writing 4 bytes to my-notebook.tex

mostafa🐌phi ~ 
$ cat my-notebook.tex 
Test

Signed-off-by: Mohammad Farzan <m2_farzan@yahoo.com>
@tobinjones
Copy link

Fixes #1558

Copy link
Contributor

@MSeal MSeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maartenbreddels @SylvainCorlay I think this is safe to merge, but I'm not 100% given template specifics used in Viola. I'm going to merge for now and put it into an alpha release so it can be tested, but it's referenced by a few issues / conversations as the workaround to this issue by making the change manually in one's installation.

@MSeal MSeal merged commit b945cda into jupyter:main Jun 7, 2021
@MSeal MSeal added this to the 6.1 milestone Jun 8, 2021
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

Successfully merging this pull request may close these issues.

Default latex template has precedence over my custom template
4 participants