Skip to content

Commit 1cb3f8a

Browse files
feat: Use locked Pixi environment for Binder deployment (#110)
* Use binder/postBuild pattern to install conda explicit spec export of Pixi environment into Binder conda environment. * Remove binder/apt.txt and binder/requirements.txt. * Update book/introduction.md to note that for pip or uv users the dependencies are in book/requirements.txt.
1 parent 33a355c commit 1cb3f8a

File tree

8 files changed

+114
-28
lines changed

8 files changed

+114
-28
lines changed

binder/apt.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

binder/postBuild

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

3-
set -e
3+
set -ex
44

5-
# Make ROOT available for comparisons and workspace use
6-
# c.f. https://github.com/conda-forge/root-feedstock
7-
conda config --add channels conda-forge
8-
conda config --set channel_priority strict
5+
# Install Pixi
6+
curl -fsSL https://pixi.sh/install.sh | sh
7+
echo 'eval "$(pixi completion --shell bash)"' >> ~/.bashrc
8+
. ~/.bashrc
9+
# Sourcing ~/.bashrc doesn't seem to pick up changes, so manually set PATH
10+
export PATH="~/.pixi/bin:${PATH}"
911

10-
# Use mamba to speed up install
11-
mamba install --yes root_base
12+
# Export workspace to conda explicit spec
13+
pixi workspace export conda-explicit-spec --platform linux-64 binder/
14+
15+
# Install environment
16+
mamba install --name notebook --file binder/default_linux-64_conda_spec.txt

binder/requirements.txt

Lines changed: 0 additions & 10 deletions
This file was deleted.

binder/runtime.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python-3.12
1+
python-3.13

book/introduction.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,7 @@ pixi run start
178178

179179
#### Using `pip`
180180

181-
then install from the included `requirements.txt` in the top level `binder/` directory of [the source repository](https://github.com/pyhf/pyhf-tutorial)
182-
183-
```
184-
(pyhf-tutorial) $ python -m pip install --upgrade --requirement binder/requirements.txt
185-
```
186-
187-
If you want to also get the dependencies to build and explore the Jupyter Book form of the tutorial you can install them with
181+
then install from the included `requirements.txt` in the top level `book/` directory of [the source repository](https://github.com/pyhf/pyhf-tutorial)
188182

189183
```
190184
(pyhf-tutorial) $ python -m pip install --upgrade --requirement book/requirements.txt

book/requirements.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1-
jupyter-book==0.15.1
1+
pyhf[xmlio,minuit,contrib]==0.7.6
2+
# visualization
3+
ipywidgets~=8.1.8
4+
ipympl~=0.9.8
5+
pandas~=2.3.3
6+
altair~=6.0.0
7+
rich==14.2.0
8+
# jupyter notebooks
9+
notebook>=7.0.0
10+
jupyterlab>=4.0.3
11+
# book
12+
jupyter-book==2.0.2

pixi.lock

Lines changed: 86 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pixi.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ altair = ">=6.0.0,<7"
2121
rich = ">=14.2.0,<15"
2222
# comparison
2323
root_base = ">=6.36.4,<7"
24+
jq = ">=1.8.1,<2"
2425

2526
[feature.lab.dependencies]
2627
notebook = ">=7.5.0,<8"

0 commit comments

Comments
 (0)