diff --git a/docs/opensafely-cli.md b/docs/opensafely-cli.md index b5ab96e58..0f60f191d 100644 --- a/docs/opensafely-cli.md +++ b/docs/opensafely-cli.md @@ -201,8 +201,8 @@ This can be useful if you want to explore the image manually. environments for developing code. You can run JupyterLab to use Jupyter notebooks via the `opensafely` -tool. This ensures that the Python code you write will work in the -OpenSAFELY environment. +tool. This allows you to run Jupyter locally but ensure that the Python code +you write will work in the OpenSAFELY environment too. From the directory containing code that you are working on, run: @@ -218,6 +218,18 @@ browser to access JupyterLab. To exit, press ++control+c++ in the command line - this also shuts down the container. Or alternatively go to File -> shutdown in the JupyterLab tab. +When you have developed a notebook to run within the OpenSAFELY environment, +you can add a `run` command to your [`project.yaml`](actions-pipelines/#projectyaml-format)` +that runs your notebook with [`nbconvert`](https://nbconvert.readthedocs.io). + +This is an example: + +``` +run: python:v2 jupyter nbconvert --execute analysis/notebook.ipynb +``` + +where `analysis/notebook.ipynb` is the location of your notebook in your repository. + ### `unzip` - unzipping CSV files If an action produces a compressed CSV file, diff --git a/docs/reports/intro.md b/docs/reports/intro.md index e1c81c038..3087cc206 100644 --- a/docs/reports/intro.md +++ b/docs/reports/intro.md @@ -74,7 +74,7 @@ This removes any code blocks in the notebook from the rendered html; to keep the To run this within an OpenSAFELY action, you can use the following run command: ``` -run: jupyter:latest jupyter nbconvert /workspace/analysis/notebook.ipynb --execute --to html --output-dir=/workspace/output --no-input --ExecutePreprocessor.timeout=86400 +run: python:v2 jupyter nbconvert /workspace/analysis/notebook.ipynb --execute --to html --output-dir=/workspace/output --no-input --ExecutePreprocessor.timeout=86400 ``` Refer to an [example of this, implemented as an OpenSAFELY action](https://github.com/opensafely/mechanical-valve-anticoag/blob/1f158504ba5a74470b11c8d73311fb2859d67cb7/project.yaml#L53-L63).