Skip to content

Commit 109873d

Browse files
committed
Merge branch 'main' into pr/653
2 parents 72ee4c7 + 1a63132 commit 109873d

7 files changed

Lines changed: 4371 additions & 3599 deletions

File tree

.github/actions/setup-project/action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,11 @@ runs:
7979
else
8080
echo "No pyproject.toml found, skipping package installation"
8181
fi
82+
83+
- name: Show dependencies
84+
shell: bash
85+
run: uv pip list
86+
87+
- name: Show Python version
88+
shell: bash
89+
run: uv run python -c "import sys; print(sys.version)"

.github/workflows/notebooks.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: notebooks
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
matrix:
17+
python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
18+
fail-fast: false
19+
20+
steps:
21+
- uses: actions/checkout@v5
22+
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v7
25+
with:
26+
enable-cache: true
27+
28+
- name: Set up Python ${{ matrix.python-version }}
29+
uses: actions/setup-python@v6
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
33+
- name: Display Python version
34+
run: python -c "import sys; print(sys.version)"
35+
36+
- name: Install dependencies
37+
shell: bash
38+
run: uv pip install ".[dev,all_extras,notebook_test]" --no-cache-dir
39+
env:
40+
UV_SYSTEM_PYTHON: 1
41+
42+
- name: Show dependencies
43+
run: uv pip list
44+
45+
# Discover all notebooks
46+
- name: Collect notebooks
47+
id: notebooks
48+
shell: bash
49+
run: |
50+
NOTEBOOKS=$(find cookbook -name '*.ipynb' -print0 | xargs -0 echo)
51+
echo "notebooks=$NOTEBOOKS" >> $GITHUB_OUTPUT
52+
53+
# Run all discovered notebooks with nbmake
54+
- name: Test notebooks
55+
shell: bash
56+
run: |
57+
uv run pytest --reruns 3 --nbmake --nbmake-timeout=3600 -vv ${{ steps.notebooks.outputs.notebooks }}

cookbook/2-Mean-Variance-Optimisation.ipynb

Lines changed: 3092 additions & 2619 deletions
Large diffs are not rendered by default.

cookbook/3-Advanced-Mean-Variance-Optimisation.ipynb

Lines changed: 230 additions & 226 deletions
Large diffs are not rendered by default.

cookbook/4-Black-Litterman-Allocation.ipynb

Lines changed: 569 additions & 414 deletions
Large diffs are not rendered by default.

cookbook/5-Hierarchical-Risk-Parity.ipynb

Lines changed: 408 additions & 339 deletions
Large diffs are not rendered by default.

pyproject.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ all_extras = [
5555
"plotly>=5.0.0,<6",
5656
"scikit-learn>=0.24.1",
5757
"ecos>=2.0.14,<2.1",
58-
"plotly>=5.0.0,<6",
58+
"plotly>=5.0.0,<7",
5959
"cvxopt; python_version < '3.14'",
6060
]
6161

@@ -66,6 +66,12 @@ dev = [
6666
"yfinance>=0.2.66",
6767
]
6868

69+
# notebook tests
70+
notebook_test = [
71+
"nbmake",
72+
"pytest-rerunfailures",
73+
]
74+
6975
[project.urls]
7076
Documentation = "https://pyportfolioopt.readthedocs.io/en/latest/"
7177
Download = "https://pypi.org/project/pyportfolioopt/#files"

0 commit comments

Comments
 (0)