|
3 | 3 | Hi! Thanks for your interest in contributing to Code-Generator. |
4 | 4 | Before submitting your contribution, please make sure to take a moment and read through the following guide: |
5 | 5 |
|
6 | | -## Repo Setup |
| 6 | +## Development Setup |
7 | 7 |
|
8 | | -**Quickstart guide for first-time contributors** |
| 8 | +You will need Nodejs LTS v14.16.x, VSCode, Vetur, and pnpm package manager. |
9 | 9 |
|
10 | | -<details> |
| 10 | +- Install [VSCode](https://code.visualstudio.com/) as per your OS. |
11 | 11 |
|
12 | | -- Install [miniconda](https://docs.conda.io/projects/continuumio-conda/en/latest/user-guide/install/index.html) for your system. |
| 12 | +- Install [Vetur extension](https://marketplace.visualstudio.com/items?itemName=octref.vetur) to get syntax highlighting for `.vue` files. You can search `Vetur` in VSCode Extensions Tab to install. |
13 | 13 |
|
14 | | -- Create an isolated conda environment for Code-Generator: |
| 14 | +- Install Nodejs LTS v14.16.x from https://nodejs.org for macOS and Windows. For Linux distributions, please follow the steps from [Node.js Website](https://nodejs.org/en/download/package-manager/) and [NodeSource GitHub](https://github.com/nodesource/distributions/blob/master/README.md#installation-instructions). |
15 | 15 |
|
16 | | - ```sh |
17 | | - conda create -n code-generator-dev python=3.8 |
18 | | - ``` |
| 16 | +- Install pnpm from https://pnpm.io/installation. Use standalone script if there is a root issue with installing with npm. |
19 | 17 |
|
20 | | -- Activate the newly created environment: |
| 18 | +- Install the dependencies with `pnpm install` in the project root directory. This might take a while to install. |
21 | 19 |
|
22 | | - ```sh |
23 | | - conda activate code-generator-dev |
24 | | - ``` |
| 20 | +- Run `pnpm run dev` to start local development server and starts editing the codes in the `src` directory. Changes will be updated on the app. |
25 | 21 |
|
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. |
| 22 | +- If you want to test building the app locally, run `pnpm run build`. This will generate the `dist` directory which contains all the codes for the app to run from CDN or web server. You can test the built codes in the `dist` with `pnpm run serve`. However, changes won't be updated on the app with this command. |
27 | 23 |
|
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. |
| 24 | +## Dependencies Explanation |
29 | 25 |
|
30 | | -</details> |
| 26 | +Code-Generator mainly depends on |
31 | 27 |
|
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 | | -When developing the app and new templates, run the app in dev mode: |
59 | | - |
60 | | -```sh |
61 | | -DEV_MODE=1 streamlit run streamlit_app.py |
62 | | -``` |
63 | | - |
64 | | -This allows to run and debug the generated templates from the `dist` folder. |
65 | | - |
66 | | -> TIP |
67 | | -> |
68 | | -> If you are adding a new template, use Single Model, Singe Optimizer Template from |
69 | | -> [Code-Generator](https://share.streamlit.io/pytorch-ignite/code-generator) itself |
70 | | -> to generate a base template and extend according to the new template you want to add. |
71 | | -
|
72 | | -## Pull Request Guidelines |
73 | | - |
74 | | -- Checkout a topic branch from a base branch, e.g. `dev`. |
75 | | - |
76 | | -- If adding a new template: |
77 | | - |
78 | | - - Please open a suggestion issue first and have it approved before working on it. |
79 | | - - Add accompanying test cases – internal tests should live in `_test_internal.py` and the rest in `test_all.py`. |
80 | | - |
81 | | -- It's OK to have multiple small commits as you work on the PR - GitHub can automatically squash them before merging. |
82 | | - |
83 | | -- Make sure tests pass! |
84 | | - |
85 | | -- 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: |
86 | | - |
87 | | - ```sh |
88 | | - # install code formatting dependencies |
89 | | - bash .github/run_code_style.sh install |
90 | | - # format the codes |
91 | | - bash .github/run_code_style.sh fmt |
92 | | - # lint the codes |
93 | | - bash .github/run_code_style.sh lint |
94 | | - ``` |
95 | | - |
96 | | -**NOTE : When sending a PR, please kindly check if the changes are required to run in the CI.** |
97 | | - |
98 | | -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. |
99 | | - |
100 | | -**NOTE : Those skip statement is case sensitive and needs open bracket `[` and close bracket `]`.** |
101 | | - |
102 | | -## Sync up with the upstream |
103 | | - |
104 | | -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: |
105 | | - |
106 | | -```sh |
107 | | -git remote add upstream https://github.com/pytorch-ignite/code-generator |
108 | | -``` |
109 | | - |
110 | | -Then you can see if you have set up multiple remote correctly by running git remote -v: |
111 | | - |
112 | | -```sh |
113 | | -origin https://github.com/<your-github-username>/code-generator (fetch) |
114 | | -origin https://github.com/<your-github-username>/code-generator (push) |
115 | | -upstream https://github.com/pytorch-ignite/code-generator (fetch) |
116 | | -upstream https://github.com/pytorch-ignite/code-generator (push) |
117 | | -``` |
118 | | - |
119 | | -Now you can get the latest development into your forked repository with this: |
120 | | - |
121 | | -```sh |
122 | | -git fetch --all --prune |
123 | | -git checkout dev |
124 | | -git merge upstream/dev |
125 | | -``` |
| 28 | +- Vue 3 – JavaScript framework to make the app reactive and maintain the state. |
| 29 | +- Vite 2 – Front end build tool to bundle the app codes. |
| 30 | +- Prismjs – For syntax highlighting. |
| 31 | +- JSZip – For zipping the files in JS. |
| 32 | +- FileSaver – For saving the zip files generated by JSZip with desired filename. |
0 commit comments