Skip to content

Commit 3ef0096

Browse files
committed
Onboarding guide draft and image assets
1 parent 8d80185 commit 3ef0096

File tree

9 files changed

+149
-0
lines changed

9 files changed

+149
-0
lines changed
429 KB
Loading
262 KB
Loading
257 KB
Loading
240 KB
Loading
237 KB
Loading
349 KB
Loading
430 KB
Loading
500 KB
Loading

docs/source/onboarding.md

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
# ExecuTorch – Open-Source Onboarding Guide
2+
3+
Welcome to **ExecuTorch** — a runtime for efficient deployment of PyTorch AI models to edge devices, including mobile phones, wearables, and embedded systems. ExecuTorch is proudly open-source and welcomes contributions from developers of all backgrounds.
4+
5+
If you're new to ExecuTorch, open-source projects, or GitHub, this guide is for you. We're excited to have you on board!
6+
7+
---
8+
9+
## 🔑 Prerequisites
10+
11+
This guide assumes a basic knowledge of Git, and how to run Git commands in your terminal.
12+
13+
If you've never used Git before, you can read [this quick guide](https://www.freecodecamp.org/news/learn-the-basics-of-git-in-under-10-minutes-da548267cc91/), [git guide](https://rogerdudler.github.io/git-guide/), [cheat sheet](https://towardsdatascience.com/git-commands-cheat-sheet-software-developer-54f6aedc1c46/), the [Setup Git](https://docs.github.com/en/get-started/git-basics/set-up-git) page from GitHub’s documentation, or watch one of the many tutorials on YouTube. Git is a powerful version control system for large coding projects - it enables you to collaborate, record code changes, and avoid losing hours of work when you make a mistake.
14+
15+
We also assume that you have a GitHub account. If you don't, please [register here](https://github.com/signup) and log in before proceeding further.
16+
17+
---
18+
19+
## 🧑‍💻 Your First Contribution
20+
21+
The first step towards making a contribution is finding something you want to work on. If you're new to the world of open-source, it might seem hard to know where to start. To help you out with this, we've collated together many beginner-friendly "good first issues" here: [New Contributors Projects and Issues](https://github.com/orgs/pytorch/projects/102/views/1). Have a look and see if anything interests you — new issues are added to this list all the time.
22+
23+
Once you've found an issue you like the look of, read our [Contribution Guide](https://github.com/pytorch/executorch/blob/main/CONTRIBUTING.md). This comprehensive manual will help you:
24+
* build ExecuTorch on your machine.
25+
* understand the structure of the wider codebase.
26+
* format, test, and document your code according to ExecuTorch best practices.
27+
* and finally, submit your code for review, so it can be polished, approved, and merged into the main codebase.
28+
29+
If that seems like a lot of information, please read on — we'll walk you through your first contribution right now.
30+
31+
---
32+
33+
## 📤 Contributing Code, Step-By-Step
34+
35+
### Prepare Your Workspace
36+
37+
Before you can start writing any code, you need to get a copy of ExecuTorch codebase onto your GitHub account, and download it onto your dev machine. You'll want to build it, too — otherwise, you won't be able to test your solution.
38+
39+
1. Fork the main ExecuTorch repository into your GitHub account. This creates a clone of the repository in your own space, so you can modify it freely. To do this, visit the [main repository page](https://github.com/pytorch/executorch) and click `Fork`:
40+
41+
![](./_static/img/onboarding/how_to_fork1.png)
42+
43+
This will take you to another page - click `Create fork`:
44+
45+
![](./how_to_fork2.png)
46+
47+
2. Clone your fork locally, and set the `upstream` pointing to the main ExecuTorch repository, so you can easily synchronize anytime with the latest development.
48+
49+
In the example below, we use HTTP, but any of the provided methods on the `Local` tab are fine. For HTTP, copy the URL given here:
50+
51+
![](./_static/img/onboarding/how_to_clone.png)
52+
53+
Then go to your terminal, enter the directory you want to clone the fork to, and run:
54+
55+
```bash
56+
git clone https://github.com/pytorch/executorch.git
57+
cd executorch # enter the cloned project
58+
git remote add upstream https://github.com/pytorch/executorch.git
59+
git remote -v # to see what you are pointing at...
60+
git fetch --all --prune # pull all branches and tags
61+
```
62+
63+
4. If you just cloned your fork, your GitHub repository will tell you your branch is up-to-date:
64+
65+
![](./_static/img/onboarding/synced_fork.png)
66+
67+
However, ExecuTorch updates frequently - if it's been a while you visited your fork, you might not have the latest version anymore. GitHub will tell you if your fork is out-of-date. To synchronise the necessary changes, click `Sync fork`, then `Update branch` as shown:
68+
69+
![](./_static/img/onboarding/unsynced_fork.png)
70+
71+
5. Now you have the latest fork on your GitHub account, it's time to download it onto your dev machine. For this, you can run the following commands in your terminal:
72+
73+
```bash
74+
git fetch --all --prune # pull all branches from GitHub
75+
git checkout main # enter your local main branch
76+
git merge upstream/main # merge latest state from GitHub parent repo
77+
git push # push updated local main to your GitHub fork
78+
```
79+
80+
6. [Build the project](https://pytorch.org/executorch/main/using-executorch-building-from-source.html) and [run the tests](https://github.com/pytorch/executorch/blob/main/CONTRIBUTING.md#testing).
81+
82+
Unfortunately, this step is too long to detail here. If you get stuck at any point, please feel free to ask for help on our [Discord server](https://discord.com/invite/Dh43CKSAdc) — we're always eager to help newcomers get onboarded.
83+
84+
### Implement your changes
85+
86+
Great job — you're all set up. Now you can actually start coding!
87+
88+
1. Before making any changes, we recommend creating a new branch. To do this, just run:
89+
```bash
90+
git checkout -b YOUR_NEW_BRANCH_NAME
91+
```
92+
93+
You can follow this naming convention: `<type>/<issue-id>_<short-name>`, where the types are: `bugfix`, `feature`, `docs`, `tests`, etc.
94+
95+
Creating a new branch means that any changes you make will be isolated to your branch, allowing you to work on multiple issues in parallel. It also means that, if your fork gets behind the main repository and you have to synchronise, you won't need to deal with any merge conflicts — accidentally blocking your `main` branch can be very time-consuming.
96+
97+
2. Make your changes. For bugfixes, we recommend a test-driven workflow:
98+
- Find a test case that demonstrates your bug.
99+
- Verify that your new test case fails on the `main` branch.
100+
- Add that example as an automated test, and assert the expected, failing results. If you can, try to make this test as minimal as possible to reduce interference with some other issue.
101+
102+
Once you have a failing test, you can keep working on the issue and running the test until it passes.
103+
104+
**Note:** Even if you do not find the solution, sending a PR with a test covering the issue is a valid contribution. From this point, we can help you find the solution, or even finish it with you.
105+
106+
3. After every set of edits, checkpoint and commit your code changes with a "commit" message that describes the changes you made. For example, in terminal:
107+
108+
```bash
109+
git add my_changed_file1 my_new_test_case # Pick the files you changed
110+
git commit -m "Fixed bug X and added a passing test case" # Describe your change
111+
```
112+
113+
4. When you are done making changes and the test case you added is passing, upload/push these changes to your fork:
114+
115+
```bash
116+
# Make sure you've committed all your changes first, then run:
117+
git push
118+
```
119+
120+
### Submit a PR
121+
122+
Once you've successfully finished local development, it's time to send out your pull request. This is the final phase — here, we'll help you finetune your changes to get merged into the main repository.
123+
124+
1. After pushing your last edit to remote, your GitHub fork will show your new changed branch — click `Compare & pull request`:
125+
126+
![](./_static/img/onboarding/how_to_pr1.png)
127+
128+
Alternatively, you can click the same `Compare & pull request` button on the main ExecuTorch repo:
129+
130+
![](./_static/img/onboarding/how_to_pr2.png)
131+
132+
Another way still is via the `Pull request` tab on the main repo — we won't go into that here though, as it takes a few more steps.
133+
134+
2. This will take you to a page where you can format your PR and explain your changes. You'll see all the required details in our PR template. You should choose a title describing the proposed fix and fill in all the required details.
135+
136+
![](./_static/img/onboarding/how_to_pr3.png)
137+
138+
In the description, you’ll describe all the changes you’ve made.
139+
140+
Ensure that all tests are passing. If not, click on a failing test to see what went wrong and make the required changes.
141+
142+
3. If everything looks good and you are ready for review, click the `Create Pull Request` button. We recommend starting with a draft PR, which will start CI (["Continuous Integration"](https://en.wikipedia.org/wiki/Continuous_integration)) to verify that all tests pass under various configurations before you notify all reviewers and get the first rounds of comments.
143+
144+
You'll need approval from 3 of our core contributors for your request to be merged. They may have questions or suggestions for you to address or respond to. Be aware that the review process may take a couple of iterations... Nevertheless, this feedback can be helpful for you as you learn more about ExecuTorch or coding best practices from other contributors.
145+
146+
Those reviewers/maintainers are here to finetune your contribution and eventually catch some issues before we merge the PR. This process shall be pleasing on both sides — we try to give and get the best.
147+
148+
149+
That's it! Congratulations on reaching the end of our guide. If you have any questions, ideas, or feedback, please feel free to join the conversation on our **[Discord Server](https://discord.com/invite/Dh43CKSAdc)**.

0 commit comments

Comments
 (0)