|
| 1 | +# Code-Generator Contribution Guide |
| 2 | + |
| 3 | +Hi! Thanks for your interest in contributing to Code-Generator. |
| 4 | +Before submitting your contribution, please make sure to take a moment and read through the following guide: |
| 5 | + |
| 6 | +## Repo Setup |
| 7 | + |
| 8 | +**Quickstart guide for first-time contributors** |
| 9 | + |
| 10 | +<details> |
| 11 | + |
| 12 | +- Install [miniconda](https://docs.conda.io/projects/continuumio-conda/en/latest/user-guide/install/index.html) for your system. |
| 13 | + |
| 14 | +- Create an isolated conda environment for Code-Generator: |
| 15 | + |
| 16 | + ```sh |
| 17 | + conda create -n code-generator-dev python=3.8 |
| 18 | + ``` |
| 19 | + |
| 20 | +- Activate the newly created environment: |
| 21 | + |
| 22 | + ```sh |
| 23 | + conda activate code-generator-dev |
| 24 | + ``` |
| 25 | + |
| 26 | +- When developing please take care of preserving `.gitignore` file and make use of `.git/info/exclude` to exclude custom files like: `.idea`, `.vscode` etc. |
| 27 | + |
| 28 | +- Please refer to [github first contributions guidelines](https://github.com/firstcontributions/first-contributions) and don't hesitate to ask the pytorch-ignite community in case of any doubt. |
| 29 | + |
| 30 | +</details> |
| 31 | + |
| 32 | +To develop and test Code-Generator: |
| 33 | + |
| 34 | +- Fork this repository. |
| 35 | + |
| 36 | +- Clone the repo and install dependencies. |
| 37 | + |
| 38 | + ```sh |
| 39 | + git clone https://github.com/<your-github-username>/code-generator.git |
| 40 | + cd code-generator |
| 41 | + pip install -r requirements-dev.txt |
| 42 | + ``` |
| 43 | + |
| 44 | +- Generate and run the tests. |
| 45 | + ```sh |
| 46 | + bash .github/run_test.sh generate |
| 47 | + bash .github/run_test.sh unittest |
| 48 | + ``` |
| 49 | + |
| 50 | +## Code development |
| 51 | + |
| 52 | +### Codebase structure |
| 53 | + |
| 54 | +- [app](https://github.com/pytorch-ignite/code-generator/tree/master/app) - Directory containing files about Streamlit App and code generation |
| 55 | +- [templates](https://github.com/pytorch-ignite/code-generator/tree/master/templates) - Directory containing ML/DL Templates |
| 56 | +- [tests](https://github.com/pytorch-ignite/code-generator/tree/master/tests) - Directory containing test related files |
| 57 | + |
| 58 | +> TIP |
| 59 | +> |
| 60 | +> If you are adding a new template, use Single Model, Singe Optimizer Template from |
| 61 | +> [Code-Generator](https://share.streamlit.io/pytorch-ignite/code-generator) itself |
| 62 | +> to generate a base template and extend according to the new template you want to add. |
| 63 | +
|
| 64 | +## Pull Request Guidelines |
| 65 | + |
| 66 | +- Checkout a topic branch from a base branch, e.g. `master`. |
| 67 | + |
| 68 | +- If adding a new template: |
| 69 | + |
| 70 | + - Please open a suggestion issue first and have it approved before working on it. |
| 71 | + - Add accompanying test cases – internal tests should live in `_test_internal.py` and the rest in `test_all.py`. |
| 72 | + |
| 73 | +- It's OK to have multiple small commits as you work on the PR - GitHub can automatically squash them before merging. |
| 74 | + |
| 75 | +- Make sure tests pass! |
| 76 | + |
| 77 | +- To ensure the codebase complies with a style guide, we use flake8, black and isort tools to format and check codebase for compliance with PEP8. Install and run with: |
| 78 | + |
| 79 | + ```sh |
| 80 | + # install code formatting dependencies |
| 81 | + bash .github/run_code_style.sh install |
| 82 | + # format the codes |
| 83 | + bash .github/run_code_style.sh fmt |
| 84 | + # lint the codes |
| 85 | + bash .github/run_code_style.sh lint |
| 86 | + ``` |
| 87 | + |
| 88 | +**NOTE : When sending a PR, please kindly check if the changes are required to run in the CI.** |
| 89 | + |
| 90 | +For example, typo changes in `CONTRIBUTING.md`, `README.md` are not required to run in the CI. So, please add `[skip ci]` in the PR title to save the resources. |
| 91 | + |
| 92 | +**NOTE : Those skip statement is case sensitive and needs open bracket `[` and close bracket `]`.** |
| 93 | + |
| 94 | +## Sync up with the upstream |
| 95 | + |
| 96 | +First, make sure you have set [upstream](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/configuring-a-remote-for-a-fork) by running: |
| 97 | + |
| 98 | +```sh |
| 99 | +git remote add upstream https://github.com/pytorch-ignite/code-generator |
| 100 | +``` |
| 101 | + |
| 102 | +Then you can see if you have set up multiple remote correctly by running git remote -v: |
| 103 | + |
| 104 | +```sh |
| 105 | +origin https://github.com/<your-github-username>/code-generator (fetch) |
| 106 | +origin https://github.com/<your-github-username>/code-generator (push) |
| 107 | +upstream https://github.com/pytorch-ignite/code-generator (fetch) |
| 108 | +upstream https://github.com/pytorch-ignite/code-generator (push) |
| 109 | +``` |
| 110 | + |
| 111 | +Now you can get the latest development into your forked repository with this: |
| 112 | + |
| 113 | +```sh |
| 114 | +git fetch --all --prune |
| 115 | +git checkout master |
| 116 | +git merge upstream/master |
| 117 | +``` |
0 commit comments