Deploying Observable Framework on Github Pages with R and Python as data loaders

I am looking at examples of deploying Observable Framework on Github Pages with R and Python as data loaders.

I am not sure of how to handle different python / R packages/libraries when deploying to github pages.

Are there any examples?

I believe Framework runs data loader at build time, when you run nom run build, and the output data file is bundled into the output directory dist, which you can then deploy to and serve from Github Pages. Therefore if your data loader is working for you at dev time, it should be working at build, too.

Did you run into any error at build or deploy?

is the correct approach to create a virtual environment for python and install the dependencies right before npm run build with Github actions?

Oh I see what you mean.

I thought you meant building locally and then deploying to Github Pages.

If I understand correctly, you are more like wanting to build a pipeline that will automatically (like triggered by new push) build from Github repo and deploy to Github Page, right? In that case, yeah you will need to setup your environment to make sure the dependencies are available when you run npm run build from your Framework directory.

This becomes more like a build pipeline setup question then.

For example, for Python, you can write a YAML file specifying what steps you want to take, including which Python version to use and what dependencies to install

Then after setting up environment and building your Observable Framework project, I am guessing you can specify the next step as publishing to GitHub Pages.

Or there is pre-built Github Action from marketplace you can explore, instead of having to do every step manually. Like

There is an example here

see for instance the “penguins-classification” example project (which is built in that same deploy action) ; it installs python and pip requirements.

1 Like

Thank you so much!! this helps a lot

Hi @nico, here’s an example for a Framework project with R & Python data loaders that automatically rebuilds & deploys to GitHub pages every 2 hours.

GitHub actions (you could also point to requirements.txt for Python modules): sf-wind-framework/.github/workflows/actions.yml at main · allisonhorst/sf-wind-framework · GitHub

Live page: San Francisco wind | Wind Data


Hi @allisonhorst thank you for your examples and videos!