Contributiong to yfinance#
yfinance relies on the community to investigate bugs and contribute code. Here’s how you can help:
Contributing#
Fork the repository on GitHub.
Clone your forked repository:
git clone https://github.com/your-username/yfinance.git
Create a new branch for your feature or bug fix:
git checkout -b feature-branch-name
Make your changes, commit them, and push your branch to GitHub. To keep the commit history and network graph compact:
Use short summaries for commits
git commit -m "short summary" -m "full commit message"
Squash tiny or negligible commits with meaningful ones.
git rebase -i HEAD~2 git push --force-with-lease origin <branch-name>
Open a pull request on the yfinance GitHub page.
For more information, see the Developer Guide.
Branches#
To support rapid development without breaking stable versions, this project uses a two-layer branch model:
dev: New features and some bug fixes are merged here. This branch allows collective testing, conflict resolution, and further stabilization before merging into the stable branch.
main: Stable branch where PIP releases are created.
By default, branches target main, but most contributions should target dev.
Exceptions: Direct merges to main are allowed if:
yfinance is massively broken
Part of yfinance is broken, and the fix is simple and isolated
Unit Tests#
Tests are written using Python’s unittest module. Here are some ways to run tests:
Run all price tests:
python -m unittest tests.test_prices
Run a subset of price tests:
python -m unittest tests.test_prices.TestPriceRepair
Run a specific test:
python -m unittest tests.test_prices.TestPriceRepair.test_ticker_missing
Run all tests:
python -m unittest discover -s tests
Rebasing#
If asked to move your branch from main to dev:
Ensure all relevant branches are pulled.
Run:
git checkout <your-branch> git rebase --onto dev main <branch-name> git push --force-with-lease origin <branch-name>
Running the GitHub Version of yfinance#
To download and run a GitHub version of yfinance, refer to GitHub discussion