chrisjsewell / ipypublish

A workflow for creating and editing publication ready scientific reports and presentations, from one or more Jupyter Notebooks, without leaving the browser!
http://ipypublish.readthedocs.io
BSD 3-Clause "New" or "Revised" License
224 stars 37 forks source link

Property-inheritence for export plugins #123

Open phelps-sg opened 4 years ago

phelps-sg commented 4 years ago

Is your feature request related to a problem? Please describe. The export plugins that ship contain many duplicated properties. Moreover, the documentation states that the procedure for creating a new export plugin is to manually copy one of the existing .json files, and then add or amend properties in the new file. This makes it hard to maintain export configurations, as it violates the once-and-only-once principle.

Describe the solution you'd like Allow export configurations to inherit properties from a parent. This would make it simpler to maintain and configure export plugins.

Describe alternatives you've considered Manually copying and/or updating all related .json files whenever a change is made.

Additional context Add any other context or screenshots about the feature request here.

chrisjsewell commented 4 years ago

Hmm, I’m on the fence about inheritance, mainly because it can be abused with multiple inheritance, that leads to the configurations becoming very opaque to understand (which is what I really don’t like about the nbconvert jinja templates). I can understand the use case though. An alternative could be to allow multiple configurations to be specified, which are then merged (in the order specified) at runtime, e.g.

{
   “a”: 1,
   “b”: 2
}

Plus

{
   “b”: 3,
   “c”: 4
}

Goes to

{
   “a”: 1,
   “b”: 3,
   “c”: 4
}