holoviz-topics / examples

Visualization-focused examples of using HoloViz for specific topics
https://examples.holoviz.org
Creative Commons Attribution 4.0 International
82 stars 24 forks source link

Add project header and better handle assets #235

Closed maximlt closed 1 year ago

maximlt commented 1 year ago

This PR adds the machinery (relies on a non yet merged branch of nbsite) to add a metadata block at the beginning of each notebook page, that metadata being pulled from the anaconda-project.yml file.

image

Previously deployments were looked for by nbsite, by hitting potential endpoints and adding those that respond successfully. Instead of doing that a scheme is added to the examples_config entry to define the deployments. The metadata header will rely on that info to add or not links to the deployments.

  deployments:
    # Will be deployed at {projname_with_hyphens}-notebook.pyviz.demo.anaconda.com
    - command: "notebook"
    # Will be deployed at {projname_with_hyphens}.pyviz.demo.anaconda.com
    - command: "dashboard"
      # [optional] Set the AE5 container resource profile.
      # Options include: "default", "medium" (default), "large"
      resource_profile: "medium"
      # [optional] Automatically start the deployment on AE5 when a PR
      # modifying the project is merged. Default is true.
      auto_deploy: true

This PR also reworked on the assets are handled. The temporary assets folder (created by tasks, and then copied by nbsite to buitdocs/. It has this structure:

It would be nice not to have to deal with the assets at all and delegate all to Sphinx. I did find a way to delegate the project archives to Sphinx using the download: role, but its UI was pretty bad so I reverted that. But I didn't find a way to handle the assets a project may have.

The changes made to the assets avoid name clashes, as assets were all copied to a flat directory.

jbednar commented 1 year ago

Very cool, thanks! Could you make the header on the page fit on one line by putting the "Download project" link right-justified after the other items?

maximlt commented 1 year ago

A full header may have multiple authors and two additional links (run notebook + open app). I also imagine we could add Twitter/LinkedIn share buttons.

Right now the header has authors + date on the first row and the links on the second row. This is using a flex component, they'll wrap on small screens.

image

I draw some inspiration from the article-info component provided by Sphinx-Design. I wish I could have reused it as is but it didn't quite fit our use case, I think.

image

Could you make the header on the page fit on one line by putting the "Download project" link right-justified after the other items?

You have no idea how long it took me to come up with this little header! :) And it's probably poorly designed.

RST ``` .. grid:: 1 1 1 2 :outline: :padding: 2 :margin: 2 4 2 2 :class-container: sd-rounded-1 .. grid-item:: :columns: 12 :margin: 0 :padding: 0 .. grid:: 1 1 1 2 :margin: 0 :padding: 1 .. grid-item:: :columns: auto :class: nbsite-metadata :material-outlined:`person;24px` `jlstevens `_ .. grid-item:: :columns: auto :class: nbsite-metadata :material-outlined:`event;24px` 2015-01-01 (Last Updated: 2023-01-18) .. grid-item:: :columns: 12 :margin: 0 :padding: 0 .. grid:: 1 1 1 3 :margin: 0 :padding: 1 .. grid-item:: :columns: auto :class: nbsite-metadata :material-outlined:`download;24px` `Download project <../assets/_archives/boids.zip>`_ .. grid-item:: :columns: auto :class: nbsite-metadata :material-outlined:`smart_display;24px` `Run notebook `_ ```

What you're asking can certainly be done, I just don't really know how and I am sure it will take me way to long compared to the benefits we'll get from it :)

maximlt commented 1 year ago

I need to merge this PR to work on the deployments. Let's revisit the header later.

jbednar commented 1 year ago

Sure! :-)