Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions docs/opensafely-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion docs/reports/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: Arguably, we should change this link to another example too, because it uses jupyter:latest.

There aren't any examples that use python:v2.

There is at least one that uses python:latest, although the actual example is simpler (notebook creates a single HTML output) compared with the example linked here (notebook creates multiple kinds of outputs).

We could address this here, but I also opened #1573 to record this case and others in the documentation.

Expand Down