You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+45-20
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,6 @@ To contribute to tsai, you will need to create a pull request, also known as a P
8
8
9
9
It's very easy to create a PR to tsai.
10
10
11
-
12
11
**Key points:**
13
12
14
13
- In this guide, we assume that you are using Linux or Mac and that you already have Anaconda or Miniconda set up. On Windows, use Ubuntu on WSL.
@@ -19,41 +18,50 @@ It's very easy to create a PR to tsai.
19
18
20
19
- We will also show you how to create a separate conda environment with all required packages. This is optional, although highly recommended.
21
20
22
-
- If you are unfamiliar with the fastai / tsai code style, be sure to read [this] (https://docs.fast.ai/dev/style.html) first. (Note that, like fastai, we do not follow PEP8, instead we follow a coding style designed specifically for numeric and interactive programming.)
21
+
- If you are unfamiliar with the fastai / tsai code style, be sure to read [this] (<https://docs.fast.ai/dev/style.html>) first. (Note that, like fastai, we do not follow PEP8, instead we follow a coding style designed specifically for numeric and interactive programming.)
23
22
24
-
## One-time only setup:
23
+
## One-time only setup
25
24
26
25
All steps in this section need to be done **<u>only the first time you set up the environment where you will develop tsai</u>**.
27
26
28
27
**Steps:**
29
28
30
29
1.**Set up gh**. If you don't have gh (GitHub CLI) yet, you can install it by following these [instructions](https://cli.github.com/manual/installation). To authenticate with your GitHub account run:
30
+
31
31
```
32
32
gh auth login
33
33
```
34
+
34
35
and follow the instructions.
35
-
2.**Create and activate a new conda environment**. This step is optional, but recommended. You will need to choose a name for the environment and a version of Python (I chose `tsai_dev` and Python 3.7, but you can choose others).
36
+
2.**Create and activate a new conda environment**. This step is optional, but recommended. You will need to choose a name for the environment and a version of Python (i.e. `tsai_dev` and Python 3.9).
37
+
36
38
```
37
-
conda create -n tsai_dev python=3.7 # python=3.7 will be used in testing, so it's better if you use it in your dev env as well to avoid issues when submitting PRs.
39
+
conda create -n tsai_dev python=3.9
38
40
conda activate tsai_dev
39
41
```
42
+
40
43
3.**Set up tsai**. We'll use an editable install.
41
44
Navigate to the folder where you want to install the tsai repo in your local machine and:
45
+
42
46
```
43
47
git clone https://github.com/timeseriesAI/tsai
48
+
cd tsai
44
49
pip install -e "tsai[dev]"
45
50
```
51
+
46
52
The last step will install all packages required to run tsai.
47
53
48
54
4.**Set up git hooks**. This step is required by nbdev. Run:
55
+
49
56
```
50
57
nbdev_install_hooks
51
58
```
52
-
inside the same tsai repo folder. Git hooks clean up the notebooks to remove the extraneous stuff stored in the notebooks. In this way you avoid unnecessary merge conflicts.
59
+
60
+
in the tsai repo folder. Git hooks clean up the notebooks to remove the extraneous stuff stored in the notebooks. In this way you avoid unnecessary merge conflicts.
53
61
54
62
Great! You are now ready to start working on your first tsai PR.
55
63
56
-
## Creating a PR:
64
+
## Creating a PR
57
65
58
66
If you have already set up your environment, you can proceed with the following steps.
59
67
@@ -65,38 +73,55 @@ If you have already set up your environment, you can proceed with the following
65
73
conda activate tsai_dev
66
74
```
67
75
68
-
2. Use ```git pull origin main``` to ensure you have the most recent version of the repo.
76
+
2. Use
77
+
78
+
```python
79
+
git pull origin main
80
+
```
81
+
82
+
to ensure you have the most recent version of the repo.
69
83
70
84
3. Navigate to the nbs folder in the local repo and open the required Jupyter Notebook you wish to modify. If you are unsure which notebook it is, you can find it at the top of the script you wish to modify. Make whatever changes you want to make in the notebooks (ie., update feature, add new feature, add tests, add documentation, etc.).
71
85
72
-
- Any new code you create needs to be in a cell with ```#export``` at the top.
86
+
- Any new code you create needs to be in a cell with ```#|export``` at the top.
73
87
- You can write Markdown text as you would normally do to document any new functionality.
74
88
- Remember that nbdev creates all scripts, tests and documentation from the notebooks. That's why it's important that you explain how the code works. You should also add tests. Tests will ensure that the new functionality keeps working in the future, when new changes are made.
75
89
- When finished, restart the kernel and re-run the whole notebook. Make sure everything runs smoothly until the end. This will also automatically save the notebook. If you see this at the bottom of the notebook "Correct conversion! 😃", it means everything went well and you can close the notebook. You are now ready to create your PR.
76
90
91
+
4. In your terminal, run
92
+
93
+
```python
94
+
nbdev_prepare
95
+
````
96
+
97
+
This will export, test, and clean notebooks, and render READMEif needed.
98
+
77
99
7. Review the files that have been changed. You can do that with:
78
100
79
101
```
80
102
git status
81
103
```
82
104
83
-
Whenever you make a change in a notebook, you should see at least see changes in its .ipynb and .py corresponding files.
105
+
Whenever you change a notebook, you should see at least see changes in its .ipynb and .py corresponding files.
106
+
107
+
4. Add your code and commit your changes:
84
108
85
-
4. Commit your changes:
86
109
```pyhon
87
110
git commit -am "add a message here"
88
111
```
89
112
90
-
5. Create a fork and push your changes there:
91
-
```python
92
-
gh repo fork
93
-
git push origin master
94
-
```
95
-
96
113
6. You are now ready to create a PR:
114
+
97
115
```python
98
-
gh pr create
116
+
gh pr create--title "brief PR title"
99
117
```
100
-
and add the required information (Title). You can skip the body (we'll do it later in GitHub). Choose Submit in What's next? That will create the PR.
101
118
102
-
8. Click on the link that will show up. That'll take you to the PR in GitHub. You can now edit the description to provide details on the PR, and click "Update comment". That's it. You'll soon receive a response from a tsai team member.
119
+
You'll get some questions:
120
+
- ? Where should we push the 'main' branch? Select: `Create a fork of timeseriesAI/tsai`
121
+
- ? Body: You can enter a brief description of the PR, do it later in GitHub or press Enter and skip this step.
122
+
- ? What's next? Select `Submit` and Enter. That will create the PR.
123
+
124
+
8. Optional: click on the link that will show up. That'll take you to the PR in GitHub. You can now edit the description to provide details on the PR, and click "Update comment". That's it.
125
+
126
+
You'll soon receive a response from a tsai team member.
127
+
Once your PR passess all tests and is merged you'll become a `tsai` contributor 🚀.
0 commit comments