Created
December 26, 2025 05:46
-
-
Save mhucka/dc3e59c48334fb98f56aac08b47eb37b to your computer and use it in GitHub Desktop.
Script to test a notebook using papermill
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| py_version="${1}" | |
| notebook_file="${2}" | |
| export PIP_INDEX_URL="https://test.pypi.org/simple/" | |
| export PIP_EXTRA_INDEX_URL="https://pypi.org/simple/" | |
| echo "~~~~ Testing ${notebook_file}" | |
| eval "$(pyenv init -)" | |
| # Deactivate any pyenv we might be inside right now. | |
| pyenv deactivate >& /dev/null || true | |
| # Ensure we have the requested version of Python. | |
| pyenv install -s "${py_version}" | |
| # (Re)create a pyenv virtual env. | |
| pyenv virtualenv-delete -f tfq-test-venv || true | |
| pyenv virtualenv -v "${py_version}" tfq-test-venv | |
| pyenv activate tfq-test-venv | |
| pip install --upgrade pip | |
| pip install papermill ipykernel | |
| papermill "${notebook_file}" "${notebook_file}.output.ipynb" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment