Skip to content

Commit e614e6b

Browse files
R5danValueRaider
authored andcommitted
Fix contributing.md
1 parent 7db2572 commit e614e6b

File tree

7 files changed

+227
-198
lines changed

7 files changed

+227
-198
lines changed

CONTRIBUTING.md

Lines changed: 29 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,37 @@
11
# Contributing
22

3+
> [!NOTE]
4+
> This is a brief guide to contributing to yfinance.
5+
> For more information See the [Developer Guide](https://ranaroussi.github.io/yfinance/development) for more information.
6+
37
## Changes
48

59
The list of changes can be found in the [Changelog](https://github.com/ranaroussi/yfinance/blob/main/CHANGELOG.rst)
610

711
## Running a branch
812

9-
### With PIP
10-
11-
```bash
12-
pip install git+https://github.com/ranaroussi/yfinance.git@BRANCH
13-
```
14-
15-
E.g.:
16-
17-
```bash
18-
pip install git+https://github.com/ranaroussi/yfinance.git@feature/something
19-
```
20-
21-
### With Git
22-
23-
1: Download from GitHub:
24-
25-
```bash
26-
git clone https://github.com/ranaroussi/yfinance.git
27-
```
28-
29-
Or if a specific branch:
30-
3113
```bash
32-
git clone -b <BRANCH NAME> https://github.com/ranaroussi/yfinance.git
33-
```
34-
35-
> [!NOTE]
36-
> Only do the next part if you are installing globally
37-
>
38-
> If you are installing for 1 specific project, then you can skip this step
39-
> and just `git clone` in the project directory
40-
41-
2: Add download location to Python search path
42-
43-
Two different ways, choose one:
44-
45-
`. Add path to PYTHONPATH environment variable
46-
1. Add to top of Python file:
47-
```python
48-
import sys
49-
sys.path.insert(0, "path/to/downloaded/yfinance")
14+
pip install git+ranaroussi/yfinance.git@dev # dev branch
5015
```
5116

52-
3: Verify
53-
54-
```python
55-
import yfinance
56-
print(yfinance)
57-
```
58-
59-
Output should be:
60-
61-
`<module 'yfinance' from 'path/to/downloaded/yfinance/yfinance/__init__.py'>`
62-
63-
If output looks like this then you did step 2 wrong
64-
65-
`<module 'yfinance' from '.../lib/python3.10/site-packages/yfinance/__init__.py'>`
66-
17+
For more information, see the [Developer Guide](https://ranaroussi.github.io/yfinance/development/running.html).
6718

6819
## Branches
6920

70-
To support rapid development without breaking stable versions, this project uses a two-layer branch model: ![image](https://private-user-images.githubusercontent.com/96923577/269063055-5afe5e2b-a43c-4a64-a736-a9e57fb5fe70.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDYxNjkxODAsIm5iZiI6MTc0NjE2ODg4MCwicGF0aCI6Ii85NjkyMzU3Ny8yNjkwNjMwNTUtNWFmZTVlMmItYTQzYy00YTY0LWE3MzYtYTllNTdmYjVmZTcwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA1MDIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNTAyVDA2NTQ0MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTZkYWJlZDQyNWMwNTBmY2M5NDY4YmQ2OWM4ZmYzYzg2NThiNGEzMzkzN2NlMjNiZWYwMGM0Mzg5NzVlOWQ4YzImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.ZK4rk7xa0w1U4KCkvv4hUKdWjuxeleuMYvZ3se6V33I) ([inspiration](https://miro.medium.com/max/700/1*2YagIpX6LuauC3ASpwHekg.png))
71-
72-
* **dev** : new features & some bug-fixes merged here, tested together, conflicts fixed, etc. Once stable, can merge to ...
73-
74-
* **main**: stable branch. Where PIP releases are created
75-
76-
77-
Most of the time you want to target the **dev** branch, but default is **main** so remember to switch to **dev**.
78-
79-
**Exception:** can straight merge into **main** if:
21+
YFinance uses a two-layer branch model:
8022

81-
* yfinance is massively broken
82-
83-
* or part of yfinance is broken and the fix is simple and clearly doesn't affect anything else
84-
85-
* or not editing part of the code (e.g. editing this file)
23+
* **dev**: new features & some bug-fixes merged here, tested together, conflicts fixed, etc.
24+
* **main**: stable branch where PIP releases are created.
8625

26+
> [!NOTE]
27+
> By default, branches target **main**, but most contributions should target **dev**.
28+
> Direct merges to **main** are allowed if:
29+
> * `yfinance` is massively broken
30+
> * Part of `yfinance` is broken, and the fix is simple and isolated
31+
> * Not updating the code (e.g. docs)
8732
33+
> [!NOTE]
34+
> For more information, see the [Developer Guide](https://ranaroussi.github.io/yfinance/development/branches.html).
8835
8936
### I'm a GitHub newbie, how do I contribute code?
9037

@@ -94,43 +41,28 @@ Most of the time you want to target the **dev** branch, but default is **main**
9441

9542
3. Create a Pull Request, from your fork to this project. If addressing an Issue, link to it
9643

44+
> [!NOTE]
45+
> See the [Developer Guide](https://ranaroussi.github.io/yfinance/development/contributing.html) for more information.
9746
98-
### [How to download & run a GitHub version of yfinance](https://github.com/ranaroussi/yfinance/discussions/1080)
47+
### [How to download & run a GitHub version of yfinance](#Running-a-branch)
9948

10049
## Documentation website
10150

102-
The new docs website [ranaroussi.github.io/yfinance/index.html](https://ranaroussi.github.io/yfinance/index.html) is generated automatically from code. When you fetch a branch or PR, probably it also has changes to docs - to generate and view this:
51+
The new docs website [ranaroussi.github.io/yfinance/index.html](https://ranaroussi.github.io/yfinance/index.html) is generated automatically from code.
10352

104-
```bash
105-
pip install -r requirements.txt
106-
pip install Sphinx==8.0.2 pydata-sphinx-theme==0.15.4 Jinja2==3.1.4 sphinx-copybutton==0.5.2
107-
sphinx-build -b html doc/source doc/_build/html
108-
python -m http.server -d ./doc/_build/html
109-
# open "localhost:8000" in browser
110-
```
53+
> [!NOTE]
54+
> See the [Developer Guide](https://ranaroussi.github.io/yfinance/development/documentation.html) for more information
55+
> Including how to build and run the docs locally.
11156
11257
## Unit tests
11358

11459
Tests have been written using the built-in Python module `unittest`. Examples:
11560

116-
* Run all price tests: `python -m unittest tests.test_prices`
117-
118-
* Run sub-set of price tests: `python -m unittest tests.test_prices.TestPriceRepair`
119-
120-
* Run a specific test: `python -m unittest tests.test_prices.TestPriceRepair.test_ticker_missing`
121-
122-
* Run all tests: `python -m unittest discover -s tests`
61+
#### Run all tests: `python -m unittest discover -s tests`
12362

12463
> [!NOTE]
125-
> The tests are currently failing already
126-
>
127-
> Standard result:
128-
>
129-
> **Failures:** 11
130-
>
131-
> **Errors:** 93
13264
>
133-
> **Skipped:** 1
65+
> See the [Developer Guide](https://ranaroussi.github.io/yfinance/development/testing.html) for more information.
13466
13567
## Git stuff
13668
### commits
@@ -139,20 +71,7 @@ To keep the Git commit history and [network graph](https://github.com/ranaroussi
13971

14072
* For long commit messages use this: `git commit -m "short sentence summary" -m "full commit message"`
14173

142-
* `squash` tiny/negligible commits back with meaningful commits, or to combine successive related commits. [Guide](https://docs.gitlab.com/ee/topics/git/git_rebase.html#interactive-rebase) but basically it's:
74+
* `squash` tiny/negligible commits back with meaningful commits, or to combine successive related commits
14375

144-
145-
```bash
146-
git rebase -i HEAD~2
147-
git push --force-with-lease origin <branch-name>
148-
```
149-
150-
### rebase
151-
152-
You might be asked to move your branch from `main` to `dev`. Make sure you have pulled **all** relevant branches then run:
153-
154-
```bash
155-
git checkout <your branch>
156-
git rebase --onto dev main <branch-name>
157-
git push --force-with-lease origin <branch-name>
158-
```
76+
> [!NOTE]
77+
> See the [Developer Guide](https://ranaroussi.github.io/yfinance/development/contributing.html#GIT-STUFF) for more information.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Branches
2+
---------
3+
4+
To support rapid development without breaking stable versions, this project uses a two-layer branch model:
5+
6+
.. image:: assets/branches.png
7+
:alt: Branching Model
8+
9+
`Inspiration <https://miro.medium.com/max/700/1*2YagIpX6LuauC3ASpwHekg.png>`_
10+
11+
- **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.
12+
- **main**: Stable branch where PIP releases are created.
13+
14+
By default, branches target **main**, but most contributions should target **dev**.
15+
16+
**Exceptions**:
17+
Direct merges to **main** are allowed if:
18+
19+
- `yfinance` is massively broken
20+
- Part of `yfinance` is broken, and the fix is simple and isolated
21+
- Not updating the code (e.g. docs)
22+
23+
Rebasing
24+
--------
25+
26+
If asked to move your branch from **main** to **dev**:
27+
28+
1. Ensure all relevant branches are pulled.
29+
2. Run:
30+
31+
.. code-block:: bash
32+
33+
git checkout {branch}
34+
git rebase --onto dev main {brach}
35+
git push --force-with-lease origin {branch}
36+
37+
Running a branch
38+
----------------
39+
40+
Please see `this page </development/running>`_.
Lines changed: 23 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,61 @@
11
********************************
2-
Contributiong to yfinance
2+
Contributing to yfinance
33
********************************
44

5-
`yfinance` relies on the community to investigate bugs and contribute code. Heres how you can help:
5+
`yfinance` relies on the community to investigate bugs and contribute code. Here&apos;s how you can help:
66

77
Contributing
88
------------
99

10-
1. Fork the repository on GitHub.
10+
1. Fork the repository on GitHub. If already forked, remember to `Sync fork`
1111
2. Clone your forked repository:
1212

1313
.. code-block:: bash
1414
15-
git clone https://github.com/your-username/yfinance.git
15+
git clone https://github.com/{user}/{repo}.git
1616
1717
3. Create a new branch for your feature or bug fix:
1818

1919
.. code-block:: bash
2020
21-
git checkout -b feature-branch-name
21+
git checkout -b {branch}
2222
2323
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:
2424

2525
Use short summaries for commits
2626

27-
.. code-block:: shell
27+
.. code-block:: bash
2828
2929
git commit -m "short summary" -m "full commit message"
3030
3131
**Squash** tiny or negligible commits with meaningful ones.
3232

33-
.. code-block:: shell
33+
.. code-block:: bash
3434
3535
git rebase -i HEAD~2
36-
git push --force-with-lease origin <branch-name>
37-
38-
5. Open a pull request on the `yfinance` GitHub page.
36+
git push --force-with-lease origin {branch}
3937
40-
For more information, see the `Developer Guide <https://github.com/ranaroussi/yfinance/discussions/1084>`_.
38+
5. Open a pull request on the `yfinance` `Github <https://github.com/ranaroussi/yfinance/pulls>`_ page.
4139

42-
Branches
40+
Git stuff
4341
---------
4442

45-
To support rapid development without breaking stable versions, this project uses a two-layer branch model:
46-
47-
.. image:: assets/branches.png
48-
:alt: Branching Model
49-
50-
`Inspiration <https://miro.medium.com/max/700/1*2YagIpX6LuauC3ASpwHekg.png>`_
51-
52-
- **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.
53-
- **main**: Stable branch where PIP releases are created.
54-
55-
By default, branches target **main**, but most contributions should target **dev**.
56-
57-
**Exceptions**:
58-
Direct merges to **main** are allowed if:
59-
60-
- `yfinance` is massively broken
61-
- Part of `yfinance` is broken, and the fix is simple and isolated
62-
63-
Unit Tests
64-
----------
65-
66-
Tests are written using Python’s `unittest` module. Here are some ways to run tests:
67-
68-
- **Run all price tests**:
69-
70-
.. code-block:: shell
71-
72-
python -m unittest tests.test_prices
73-
74-
- **Run a subset of price tests**:
75-
76-
.. code-block:: shell
77-
78-
python -m unittest tests.test_prices.TestPriceRepair
79-
80-
- **Run a specific test**:
81-
82-
.. code-block:: shell
83-
84-
python -m unittest tests.test_prices.TestPriceRepair.test_ticker_missing
85-
86-
- **Run all tests**:
87-
88-
.. code-block:: shell
89-
90-
python -m unittest discover -s tests
91-
92-
Rebasing
93-
--------------
43+
To keep the Git commit history and [network graph](https://github.com/ranaroussi/yfinance/network) compact please follow these two rules:
9444

95-
If asked to move your branch from **main** to **dev**:
45+
- For long commit messages use this: `git commit -m "short sentence summary" -m "full commit message"`
9646

97-
1. Ensure all relevant branches are pulled.
98-
2. Run:
47+
- `squash` tiny/negligible commits back with meaningful commits, or to combine successive related commits. [Guide](https://docs.gitlab.com/ee/topics/git/git_rebase.html#interactive-rebase) but basically it's:
9948

100-
.. code-block:: shell
49+
.. code-block:: bash
50+
git rebase -i HEAD~2
51+
git push --force-with-lease origin {branch}
10152
102-
git checkout <your-branch>
103-
git rebase --onto dev main <branch-name>
104-
git push --force-with-lease origin <branch-name>
10553
106-
Running the GitHub Version of yfinance
107-
--------------------------------------
54+
### rebase
55+
56+
You might be asked to move your branch from `main` to `dev`. Make sure you have pulled **all** relevant branches then run:
10857

109-
To download and run a GitHub version of `yfinance`, refer to `GitHub discussion <https://github.com/ranaroussi/yfinance/discussions/1080>`_
58+
.. code-block:: bash
59+
git checkout {branch}
60+
git rebase --onto dev main {brach}
61+
git push --force-with-lease origin {branch}

0 commit comments

Comments
 (0)