Skip to content

Remove bash execution from cookbook notebooks#724

Open
wavebyrd wants to merge 1 commit intoPyPortfolio:mainfrom
wavebyrd:remove-bash-from-notebooks
Open

Remove bash execution from cookbook notebooks#724
wavebyrd wants to merge 1 commit intoPyPortfolio:mainfrom
wavebyrd:remove-bash-from-notebooks

Conversation

@wavebyrd
Copy link

Summary

  • Remove !pip install commands from all 5 cookbook notebooks
  • Remove git clone and os.chdir() commands that were used for Colab/Kaggle setup
  • Replace with simple Python-based directory detection

Changes

All 5 notebooks updated:

  • 1-RiskReturnModels.ipynb
  • 2-Mean-Variance-Optimisation.ipynb
  • 3-Advanced-Mean-Variance-Optimisation.ipynb
  • 4-Black-Litterman-Allocation.ipynb
  • 5-Hierarchical-Risk-Parity.ipynb

The preamble cell now just handles the directory structure:

import os

# Change to cookbook directory if running from repo root
if os.path.isdir("cookbook/data") and not os.path.isdir("data"):
    os.chdir("cookbook")

Test plan

  • Verify notebooks run locally with the notebooks depset
  • Confirm no bash execution remains (!pip, !git, %%bash)

Fixes #717

🤖 Generated with Claude Code

Remove !pip install and git clone commands from the preamble cells of all
cookbook notebooks. These bash executions are unnecessary for local
development and can cause issues in various environments.

The notebooks now use a simple Python-based approach to handle the
directory structure when running from the repo root.

Fixes PyPortfolio#717

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@wavebyrd
Copy link
Author

Ping on this notebook cleanup - removes bash execution from cookbook. Ready for review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENH] remove bash execution from cookbook notebooks

1 participant