Skip to content

Conversation

@tschm
Copy link
Contributor

@tschm tschm commented Nov 15, 2025

Get rid of yfinance. Create on csv file serving all notebooks

@tschm
Copy link
Contributor Author

tschm commented Nov 15, 2025

@fkiraly this is good to be merged. Now using one flat file common for all notebooks. I have added the script to generate this file.

Copy link
Collaborator

@fkiraly fkiraly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! I really think we need to replace downloads by onboard data.

  • I believe you have to explicitly request csv to be packaged in pyproject, or users will not be able to load the data. This becomes apparent in the wheels/release test (but we are not running a packaging test regularly).
  • could you do separate things in separate PR? E.g., linting the notebooks, changing dependencies, etc.
  • The pattern that I would use is adding a load_datasetname function instead of directly loading a csv. That makes the notebook easier to read.

Different topic, I think the pip installs should be removed from the notebooks, this messes up the VM that tests the notebooks.

@fkiraly fkiraly changed the title No yfinance [ENH] in notebooks, replace yfinance download with loaders Nov 15, 2025
@fkiraly
Copy link
Collaborator

fkiraly commented Nov 15, 2025

Plus, could you please, please write descriptive summaries for your PR? Use AI if you need to.

@tschm
Copy link
Contributor Author

tschm commented Nov 15, 2025

I don't understand. Do you want to include the notebooks in the package released?

@tschm
Copy link
Contributor Author

tschm commented Nov 15, 2025

import os
if not os.path.isdir('data'):
    os.system('git clone https://github.com/pyportfolio/pyportfolioopt.git')
    os.chdir('PyPortfolioOpt/cookbook')

??? why would one have this in a notebook?

@fkiraly
Copy link
Collaborator

fkiraly commented Nov 15, 2025

I don't understand. Do you want to include the notebooks in the package released?

no, I want loader functions for the csv in the package release, and the notebooks then import the loader from the package, rather than loading the csv directly.

from pypfopt.data import load_something

my_dummydata = load_something()

All the csv manipulation is hidden underneath, ensuring that the notebook is short and does not distract from what is being shown.

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.

2 participants