Skip to content

Commit d08afa2

Browse files
authored
Merge pull request #2489 from ranaroussi/dev
sync dev -> main
2 parents 4c23d33 + 5bd805b commit d08afa2

File tree

17 files changed

+201
-191
lines changed

17 files changed

+201
-191
lines changed

.github/workflows/deploy_doc.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ name: Build and Deploy Sphinx Docs
33
on:
44
push:
55
branches:
6-
- dev-documented
6+
- main
7+
# - dev-documented
78
workflow_dispatch:
89

910
jobs:

.github/workflows/ruff.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v3
1313
- uses: chartboost/ruff-action@v1
14+
with:
15+
args: check . --exclude yfinance/pricing_pb2.py

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ Install `yfinance` from PYPI using `pip`:
5353
$ pip install yfinance
5454
```
5555

56+
### [yfinance relies on the community to investigate bugs and contribute code. Here's how you can help.](CONTRIBUTING.md)
57+
5658
---
5759

5860
![Star History Chart](https://api.star-history.com/svg?repos=ranaroussi/yfinance)

doc/source/advanced/caching.rst

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,6 @@
11
Caching
22
=======
33

4-
Smarter Scraping
5-
----------------
6-
7-
Install the `nospam` package to cache API calls and reduce spam to Yahoo:
8-
9-
.. code-block:: bash
10-
11-
pip install yfinance[nospam]
12-
13-
To use a custom `requests` session, pass a `session=` argument to
14-
the Ticker constructor. This allows for caching calls to the API as well as a custom way to modify requests via the `User-agent` header.
15-
16-
.. code-block:: python
17-
18-
import requests_cache
19-
session = requests_cache.CachedSession('yfinance.cache')
20-
session.headers['User-agent'] = 'my-program/1.0'
21-
ticker = yf.Ticker('MSFT', session=session)
22-
23-
# The scraped response will be stored in the cache
24-
ticker.actions
25-
26-
27-
Combine `requests_cache` with rate-limiting to avoid triggering Yahoo's rate-limiter/blocker that can corrupt data.
28-
29-
.. code-block:: python
30-
31-
from requests import Session
32-
from requests_cache import CacheMixin, SQLiteCache
33-
from requests_ratelimiter import LimiterMixin, MemoryQueueBucket
34-
from pyrate_limiter import Duration, RequestRate, Limiter
35-
class CachedLimiterSession(CacheMixin, LimiterMixin, Session):
36-
pass
37-
38-
session = CachedLimiterSession(
39-
limiter=Limiter(RequestRate(2, Duration.SECOND*5)), # max 2 requests per 5 seconds
40-
bucket_class=MemoryQueueBucket,
41-
backend=SQLiteCache("yfinance.cache"),
42-
)
43-
44-
454
Persistent Cache
465
----------------
476

doc/source/development/branches.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
********
12
Branches
2-
---------
3+
********
34

45
To support rapid development without breaking stable versions, this project uses a two-layer branch model:
56

doc/source/development/code.rst

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
****
2+
Code
3+
****
4+
5+
1. Fork the repository on GitHub. If already forked, remember to `Sync fork`
6+
2. Clone your forked repository:
7+
8+
.. code-block:: bash
9+
10+
git clone https://github.com/{user}/{repo}.git
11+
12+
3. Create a new branch for your feature or bug fix, from appropriate base branch:
13+
14+
.. code-block:: bash
15+
16+
git checkout {base e.g. dev}
17+
git pull
18+
git checkout -b {branch}
19+
20+
4. Make your changes, commit them, and push your branch to GitHub. To keep the commit history and `network graph <https://github.com/ranaroussi/yfinance/network>`_ compact:
21+
22+
- for long commit messages use this format. Your long message can be multiple lines (tip: copy-paste):
23+
24+
.. code-block:: bash
25+
26+
git commit -m "short sentence summary" -m "full commit message"
27+
28+
- **git squash** tiny or negligible commits with meaningful ones, or to combine successive related commits. `git squash guide <https://docs.gitlab.com/ee/topics/git/git_rebase.html#interactive-rebase>`_
29+
30+
.. code-block:: bash
31+
32+
git rebase -i HEAD~2
33+
git push --force-with-lease origin {branch}
34+
35+
5. If your branch is old and missing important updates in base branch, then instead of merging in, do a git rebase. This keeps your branch history clean. E.g.
36+
37+
.. code-block:: bash
38+
39+
git checkout {base e.g. dev}
40+
git pull
41+
git checkout {branch}
42+
git rebase {base}
43+
git push --force-with-lease origin {branch}
44+
45+
6. `Open a pull request on Github <https://github.com/ranaroussi/yfinance/pulls>`_.
46+
47+
More Git stuff
48+
---------
49+
50+
- ``git rebase``. You might be asked to move your branch from ``main`` to ``dev``. Important to update **all** relevant branches.
51+
52+
.. code-block:: bash
53+
54+
# update all branches:
55+
git checkout main
56+
git pull
57+
git checkout dev
58+
git pull
59+
# rebase:
60+
git checkout {branch}
61+
git pull
62+
git rebase --onto dev main {branch}
63+
git push --force-with-lease origin {branch}
64+

doc/source/development/contributing.rst

Lines changed: 0 additions & 61 deletions
This file was deleted.

doc/source/development/documentation.rst

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
*************************************
2-
Contribution to the documentation
3-
*************************************
1+
*************
2+
Documentation
3+
*************
44

55
.. contents:: Documentation:
66
:local:
@@ -36,15 +36,18 @@ To build the documentation locally, follow these steps:
3636
3737
3. **View Documentation Locally**:
3838

39-
..code-block:: bash
39+
.. code-block:: bash
40+
4041
python -m http.server -d ./doc/_build/html
4142
4243
Then open "localhost:8000" in browser
4344

4445

45-
Building documentation on main
46-
------------------------------
47-
The documentation updates are built on merge to ``main`` branch. This is done via GitHub Actions workflow based on ``/yfinance/.github/workflows/deploy_doc.yml``.
46+
Publishing documentation
47+
------------------------
48+
49+
Merge into ``main`` branch triggers auto-generating documentation by action ``.github/workflows/deploy_doc.yml``.
50+
This publishes the generated HTML into branch ``documentation``.
4851

4952
1. Review the changes locally and push to ``dev``.
5053

doc/source/development/index.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
Development
33
===========
44

5+
yfinance relies on the community to investigate bugs and contribute code. Here's how you can help:
6+
57
.. toctree::
68
:maxdepth: 1
79

8-
contributing
10+
code
911
documentation
10-
reporting_bug
1112
branches
1213
testing
1314
running

doc/source/development/reporting_bug.rst

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)