Skip to content

Commit ba55cc2

Browse files
committed
chore: add repo structure guide
1 parent 18df1c9 commit ba55cc2

16 files changed

Lines changed: 77 additions & 508 deletions

CONTRIBUTING.md

Lines changed: 16 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -3,123 +3,30 @@
33
Hi! Thanks for your interest in contributing to Code-Generator.
44
Before submitting your contribution, please make sure to take a moment and read through the following guide:
55

6-
## Repo Setup
6+
## Development Setup
77

8-
**Quickstart guide for first-time contributors**
8+
You will need Nodejs LTS v14.16.x, VSCode, Vetur, and pnpm package manager.
99

10-
<details>
10+
- Install [VSCode](https://code.visualstudio.com/) as per your OS.
1111

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.
1313

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).
1515

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.
1917

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.
2119

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.
2521

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.
2723

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
2925

30-
</details>
26+
Code-Generator mainly depends on
3127

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.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[![Streamlit App][streamlit-img]][streamlit-url]
22
[![ci][gha-img]][gha-url]
3+
34
<!-- [![Preview App][aws-img]][aws-url] -->
45

56
# Code Generator
@@ -26,6 +27,7 @@ Development of this project is supported by NumFOCUS Small Development Grant. We
2627

2728
<!-- [aws-img]: https://badgen.net/badge/%20/Deployed%20master%20version/ee4c2c?label= -->
2829
<!-- [aws-url]: http://pytorch-ignite-code-generator-dev.eu-west-3.elasticbeanstalk.com/ -->
30+
2931
[gha-img]: https://github.com/pytorch-ignite/code-generator/actions/workflows/ci.yml/badge.svg
3032
[gha-url]: https://github.com/pytorch-ignite/code-generator/actions/workflows/ci.yml
3133
[streamlit-img]: https://static.streamlit.io/badges/streamlit_badge_black_white.svg

package.json

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"name": "code-generator-js",
2+
"name": "@pytorch-ignite/code-generator",
33
"version": "1.0.0",
44
"scripts": {
55
"dev": "vite",
66
"build": "vite build",
77
"serve": "vite preview",
88
"black": "black src/templates -l 80",
9-
"isort": "isort src/templates",
9+
"isort": "isort src/templates --profile black",
1010
"fmt": "prettier --write . && pnpm run black && pnpm run isort"
1111
},
1212
"devDependencies": {
@@ -20,9 +20,7 @@
2020
"@vue/compiler-sfc": "^3.0.11",
2121
"conventional-changelog-cli": "^2.1.1",
2222
"prettier": "^2.2.1",
23-
"vite": "^2.2.3",
24-
"vite-plugin-windicss": "^0.14.6",
25-
"windicss": "^2.5.14"
23+
"vite": "^2.2.3"
2624
},
2725
"prettier": {
2826
"semi": false,

0 commit comments

Comments
 (0)