UCB-stat-159-s23 / site

Public website for the "Collaborative and Reproducible Data Science" course at UC Berkeley (Stat 159/259, Spring 2023 term).
https://ucb-stat-159-s23.github.io/site/
8 stars 6 forks source link

Let's instrument the site (if possible) to show a built preview of all PRs. #3

Open fperez opened 1 year ago

fperez commented 1 year ago

It would be great to add an action that does a full build of the site for any PRs. This way, one could more easily see the result of the changes in a real site rather than imagining what they look like from the sources, or having to do a local build.

This would be similar to what we do in many Jupyter projects (see an example here in JupyterLab) where we automatically build a Binder link for anyone to be able to view the PR's effect without having to do a build.

I haven't looked into how to do it, but I'm sure it's possible...

facusapienza21 commented 1 year ago

That will be great! I was doing the build of the JupyterBook in local, but it's very inconvenient at the moment of checking how the new website looks like. I will explore this.

facusapienza21 commented 1 year ago

Thank you @yuvipanda for his feedback on this. What we need is Read the Docs for JupyteBook, which should create a different link where you can see the changes in the PR. I will add this to the repository to see if it works!

facusapienza21 commented 1 year ago

I was exploring this but still wasn't able to make it work.

I was able to set up the readtodocs page following the tutorial. However, in order to readthedocs to work with a JupyterBook, an extra configuration step needs to be made, as it is explained in the JupyterBook documentation. This requieres the configuration of sphinx to work, which can be done with the creation of the conf.py file:

version: 2

build:
  os: ubuntu-22.04
  tools:
    python: "3.8"
  jobs:
    pre_build:
      # Generate the Sphinx configuration for this Jupyter Book so it builds.
      - "jupyter-book config sphinx ."

# Build documentation in the docs/ directory with Sphinx
sphinx:
   configuration: docs/conf.py

   # Optionally declare the Python requirements required to build your docs
python:
   install:
   - requirements: book-requirements.txt

However, this doesn't work when building the readthedocs

Screen Shot 2023-02-02 at 7 56 23 PM

I need to explore why it doesn't recognizes the conf.py file even when is there.

Once this is working, it should be easy to integrate this with PR, as it is explined in the readthedocs documentation.