jupyter / jupyter/nbconvert

Using Both DictLoaders and extra_template_basedirs

Open
#2,011 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.9k
Forks
613
Avg merge
2h 11m
Merged PRs (30d)
1

Description

I have a custom template, extending from HTMLExporter. I pass a path to the directory with this template through `extra_template_basedirs` in the `HTMLExporter` Constructor. I then want to extend my custom template programmatically (i.e., the full inheritance is HTMLTemplate > Custom Template in filesystem > Custom template defined through DictLoader). The DictLoader template changes between invocations, so it must be programmatic. However, because the templates passed through extra_loaders are loaded before the ones passed through extra_template_basedirs, the dynamic DictLoader template cannot find the custom template in the filesystem. Is it possible to do this with nbconvert?

In the case of an XY problem, my overall use case is that I want to define a variable in my custom template, that can be set programmatically when we're exporting the notebook.

Contributor guide

Open the contributing guide

Research direction

Start at the HTMLExporter constructor and trace how extra_loaders and extra_template_basedirs are ordered. Check whether a DictLoader template can inherit from the filesystem template while changing between exports; done means the dynamic template resolves that inheritance, or the supported limitation and alternative are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter, python
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.