executablebooks / sphinx-book-theme

A clean book theme for scientific explanations and documentation with Sphinx
https://sphinx-book-theme.readthedocs.io
BSD 3-Clause "New" or "Revised" License
431 stars 197 forks source link

Possibility of modularizing/upstreaming notebook launching feature? #326

Open rossbar opened 3 years ago

rossbar commented 3 years ago

Is your feature request related to a problem? Please describe.

The sphinx-book-theme is excellent, and has a lot of nice features especially re: launching pages on interactive platforms (binder, jupyterlab, etc.)

There are several projects where the goal is to supplement the official project documentation with longer form documentation, allowing users to submit notebooks to highlight applications etc. These projects are usually separate from the main documentation, but we'd like to have the two sites as tightly integrated as possible, which includes having consistent theming.

There is a lot of overlap between the pydata-sphinx-theme and sphinx-book-theme in terms of both aesthetics and features (by design); however we want to try to use the pydata theme to have 100% aesthetic consistency, see e.g. networkx/notebooks#29. The main feature we lose in doing so is the excellent launch-button functionality of the sphinx-book-theme - hence the question:

Describe the solution you'd like

Would there be interest in upstreaming the launch.py functionality to the pydata-sphinx-theme? I realize that many projects won't have executable code embedded in their documentation, so this probably isn't a relevant feature for many projects adopting the theme.

Describe alternatives you've considered

Since not all documentation projects will have executable code as part of the documentation, another possible alternative would be to break the launch.py code off into it's own sphinx extension.

Additional context

This would benefit projects like numpy-tutorials and networkx notebooks.

welcome[bot] commented 3 years ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

choldgraf commented 3 years ago

It's definitely something I'm open to - TBH I wonder if MyST-NB would be a better place for this than the sphinx book theme, though I'm not sure what would be the best way to expose the functionality.

rossbar commented 3 years ago

I'm not sure what the best way would be either - it may also be possible to replicate the behavior with some minimal templates without having to necessarily move anything around. We'll give it some more thought and see if we can't come up with a flexible solution.

choldgraf commented 3 years ago

I am more than happy to review any attempts at implementing this :-)

chrisjsewell commented 3 years ago

Well the other thing to point to is https://github.com/executablebooks/meta/issues/279, where we are already looking to modularise things from the ground up

choldgraf commented 3 years ago

For sure - to me the big question is whether "launch buttons" are best-encoded at the theme level, or via some other mechanism. Those only make sense in the context of a user w/ computational notebooks, which is why I feel like MyST-NB might make the most sense. But it seems weird for MyST-NB to provide functionality that theme developers would utilize (launch buttons). That said, this is basically what we do with sphinx-thebe so maybe it's a reasonable approach?

If it existed inside MyST-NB, I'd imagine something like:

That way, a user can manually place a "launch button" on their page, but if they're using a theme with native support for this, a button will automatically appear.