From ee576440e49c0f1106187ff12f865b7a39747c47 Mon Sep 17 00:00:00 2001 From: Jonathan Felder Date: Tue, 16 Jul 2024 16:27:42 -0700 Subject: [PATCH] [DH-333] making webpdf export work for astro --- deployments/astro/image/apt.txt | 4 ++++ deployments/astro/image/environment.yml | 2 +- deployments/astro/image/postBuild | 6 +++++- deployments/astro/image/start | 5 +++++ 4 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 deployments/astro/image/start diff --git a/deployments/astro/image/apt.txt b/deployments/astro/image/apt.txt index 895f0e6c3..422e2ccbc 100644 --- a/deployments/astro/image/apt.txt +++ b/deployments/astro/image/apt.txt @@ -24,3 +24,7 @@ vim # For jupyter-tree-download. Ref: https://github.com/berkeley-dsep-infra/datahub/issues/3979 zip + +# playwright deps https://jira-secure.berkeley.edu/browse/DH-305 +libnss3 +libnspr4 diff --git a/deployments/astro/image/environment.yml b/deployments/astro/image/environment.yml index 16d4ab815..325a15304 100644 --- a/deployments/astro/image/environment.yml +++ b/deployments/astro/image/environment.yml @@ -106,6 +106,6 @@ dependencies: - twine - otter-grader==3.1.4 # for notebook exporting - - nbconvert==7.6.0 + - nbconvert[webpdf]==7.16.4 - nb2pdf==0.6.2 - nbpdfexport==0.2.1 diff --git a/deployments/astro/image/postBuild b/deployments/astro/image/postBuild index 7c3e8550c..b1b290345 100644 --- a/deployments/astro/image/postBuild +++ b/deployments/astro/image/postBuild @@ -1,6 +1,10 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail # 2024-01-13 sknapp: incompatible due to notebook 7 # jupyter contrib nbextensions install --sys-prefix --symlink # jupyter nbextensions_configurator enable --sys-prefix + +# installing chromium browser to enable webpdf conversion using nbconvert +export PLAYWRIGHT_BROWSERS_PATH=${CONDA_DIR} +playwright install chromium diff --git a/deployments/astro/image/start b/deployments/astro/image/start new file mode 100644 index 000000000..c3a978b7f --- /dev/null +++ b/deployments/astro/image/start @@ -0,0 +1,5 @@ +#!/bin/bash + +# See https://jira-secure.berkeley.edu/browse/DH-305 +export PLAYWRIGHT_BROWSERS_PATH=${CONDA_DIR} +exec "$@"