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
115 changes: 76 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,71 +5,108 @@ on:
branches: [main]
pull_request:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
PIP_DISABLE_PIP_VERSION_CHECK: "1"
PYTHONDONTWRITEBYTECODE: "1"
PYTHONHASHSEED: "0"

jobs:
test:
name: pytest (py${{ matrix.python-version }})
base:
name: base py${{ matrix.python-version }} / ${{ matrix.dependency-set }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
include:
- python-version: "3.12"
dependency-set: minimum
numpy-spec: "numpy==2.2.0"
- python-version: "3.12"
dependency-set: latest
numpy-spec: "numpy>=2.2,<3"
- python-version: "3.13"
dependency-set: minimum
numpy-spec: "numpy==2.2.0"
- python-version: "3.13"
dependency-set: latest
numpy-spec: "numpy>=2.2,<3"
- python-version: "3.14"
dependency-set: minimum
numpy-spec: "numpy==2.3.2"
- python-version: "3.14"
dependency-set: latest
numpy-spec: "numpy>=2.3.2,<3"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install package with all extras
- name: Install the base distribution
run: |
python -m pip install --upgrade pip
pip install -e ".[all]" pytest
- name: Run tests
# test/pde requires a working torch runtime; revisit when pde is
# re-validated (see IMPROVEMENT_PLAN.md phase 3).
run: pytest -q --ignore=test/pde
python -m pip install "${{ matrix.numpy-spec }}"
python -m pip install . "pytest>=8.4,<10"
- name: Verify installed-package origin
working-directory: ${{ runner.temp }}
env:
RISKLABAI_REPOSITORY_ROOT: ${{ github.workspace }}
run: python -B -c "import os; from pathlib import Path; import RiskLabAI; origin = Path(RiskLabAI.__file__).resolve(); repository = Path(os.environ['RISKLABAI_REPOSITORY_ROOT']).resolve(); assert not origin.is_relative_to(repository), (origin, repository); assert RiskLabAI.__version__ == '3.0.0'; print(origin)"
- name: Run the installed base package tests
working-directory: ${{ runner.temp }}
run: python -B -m pytest -q -p no:cacheprovider -c "$GITHUB_WORKSPACE/pyproject.toml" "$GITHUB_WORKSPACE/test"

minimal-install:
name: base install is importable
optional:
name: optional features py${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install base package only (no extras)
- name: Install feature-specific optional groups
run: |
python -m pip install --upgrade pip
pip install .
- name: Import every public sub-package
python -m pip install ".[speed,pde,synth,hpo,plot,symbolic,profile,simulation,changepoints,test]"
- name: Verify changepoint availability policy
run: |
python -c "
import RiskLabAI
print('version:', RiskLabAI.__version__)
for sub in ['backtest', 'cluster', 'controller', 'data',
'ensemble', 'features', 'hpc', 'optimization', 'utils']:
getattr(RiskLabAI, sub)
print('ok:', sub)
"

format:
name: black
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: pip install "black==26.5.1"
- run: black --check RiskLabAI test
if [[ "${{ matrix.python-version }}" == "3.14" ]]; then
python -B -c "import importlib.util; assert importlib.util.find_spec('ruptures') is None"
else
python -B -c "import ruptures"
fi
- name: Verify installed-package origin
working-directory: ${{ runner.temp }}
env:
RISKLABAI_REPOSITORY_ROOT: ${{ github.workspace }}
run: python -B -c "import os; from pathlib import Path; import RiskLabAI; origin = Path(RiskLabAI.__file__).resolve(); repository = Path(os.environ['RISKLABAI_REPOSITORY_ROOT']).resolve(); assert not origin.is_relative_to(repository), (origin, repository); assert RiskLabAI.__version__ == '3.0.0'; print(origin)"
- name: Run the installed optional-feature tests
working-directory: ${{ runner.temp }}
run: python -B -m pytest -q -p no:cacheprovider -c "$GITHUB_WORKSPACE/pyproject.toml" "$GITHUB_WORKSPACE/test"

lint:
name: ruff
quality:
name: static quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: pip install "ruff==0.15.17"
- run: ruff check RiskLabAI test
python-version: "3.14"
- name: Install pinned quality tools
run: python -m pip install "black==26.5.1" "ruff==0.15.17"
- name: Black
run: black --check src/RiskLabAI/causal_factor_analysis test/causal_factor_analysis
- name: Ruff
run: ruff check src/RiskLabAI/causal_factor_analysis test/causal_factor_analysis
6 changes: 1 addition & 5 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
BSD 3-Clause License

Copyright (c) 2022, RiskLab AI (risklab.ai)
Copyright (c) 2022-2026, Hamid Arian
All rights reserved.

RiskLabAI includes codes and algorithms from Marcos López de Prado's books
"Advances in Financial Machine Learning" and
"Machine Learning for Asset Managers".

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

Expand Down
16 changes: 16 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
include LICENSE
include README.md
include RELEASE_NOTES_NEXT_MAJOR.md
include PUBLIC_API.json
include TEST_INVENTORY.json
include PACKAGE_FILES.json
include PACKAGE_INSPECTION.md
include .github/workflows/ci.yml
recursive-include src *.py
recursive-include test *.py
recursive-include docs *.md
recursive-include examples *.py
global-exclude __pycache__
global-exclude *.py[cod]
global-exclude .DS_Store
global-exclude Thumbs.db
Loading
Loading