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
8 changes: 8 additions & 0 deletions .github/actions/setup-project/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,11 @@ runs:
else
echo "No pyproject.toml found, skipping package installation"
fi

- name: Show dependencies
shell: bash
run: uv pip list

- name: Show Python version
shell: bash
run: uv run python -c "import sys; print(sys.version)"
57 changes: 57 additions & 0 deletions .github/workflows/notebooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: notebooks

on:
pull_request:
push:
branches:
- main
permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
fail-fast: false

steps:
- uses: actions/checkout@v5

- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: Install dependencies
shell: bash
run: uv pip install ".[dev,all_extras,notebook_test]" --no-cache-dir
env:
UV_SYSTEM_PYTHON: 1

- name: Show dependencies
run: uv pip list

# Discover all notebooks
- name: Collect notebooks
id: notebooks
shell: bash
run: |
NOTEBOOKS=$(find cookbook -name '*.ipynb' -print0 | xargs -0 echo)
echo "notebooks=$NOTEBOOKS" >> $GITHUB_OUTPUT

# Run all discovered notebooks with nbmake
- name: Test notebooks
shell: bash
run: |
uv run pytest --reruns 3 --nbmake --nbmake-timeout=3600 -vv ${{ steps.notebooks.outputs.notebooks }}
14,254 changes: 7,371 additions & 6,883 deletions cookbook/2-Mean-Variance-Optimisation.ipynb

Large diffs are not rendered by default.

2,701 changes: 1,363 additions & 1,338 deletions cookbook/3-Advanced-Mean-Variance-Optimisation.ipynb

Large diffs are not rendered by default.

2,403 changes: 1,286 additions & 1,117 deletions cookbook/4-Black-Litterman-Allocation.ipynb

Large diffs are not rendered by default.

1,469 changes: 776 additions & 693 deletions cookbook/5-Hierarchical-Risk-Parity.ipynb

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ dev = [
"isort",
]

# notebook tests
notebook_test = [
"nbmake",
"pytest-rerunfailures",
]

[project.urls]
Documentation = "https://pyportfolioopt.readthedocs.io/en/latest/"
Download = "https://pypi.org/project/pyportfolioopt/#files"
Expand Down