Skip to content

Commit 1ae6e2a

Browse files
committed
Update and format CONTRIBUTING.md
1 parent fb127dc commit 1ae6e2a

File tree

1 file changed

+71
-44
lines changed

1 file changed

+71
-44
lines changed

CONTRIBUTING.md

Lines changed: 71 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,14 @@ Thank you for your interesting in contributing to this open-source project! Make
77
Please follow the following steps for local testing:
88

99
1. Clone the repo
10+
1011
```commandline
1112
git clone https://github.com/plotly/dash-cytoscape.git
1213
```
13-
2. In order to run the Python builds (`npm run build:backends`) you need to create a
14-
venv for this project. Make sure you have `virtualenv` correctly installed and run this:
14+
15+
2. In order to run the Python builds (`npm run build:all`) you need to create a
16+
venv for this project. Make sure you have `virtualenv` correctly installed and run this:
17+
1518
```commandline
1619
mkdir dash_cytoscape_dev
1720
cd dash_cytoscape_dev
@@ -21,14 +24,16 @@ pip install -r requirements.txt # Install the requirements
2124
```
2225

2326
To activate in windows, replace the 4th line with this:
27+
2428
```commandline
25-
venv\Scripts\activate
29+
venv\Scripts\activate
2630
```
2731

2832
3. Install the JavaScript dependencies and build the code:
33+
2934
```commandline
3035
npm install
31-
npm run build:backends
36+
npm run build:all
3237
```
3338

3439
#### Package manager
@@ -37,12 +42,10 @@ Before v0.2.0, our preferred package manager for this project is Yarn. Starting
3742

3843
## Coding Style
3944

40-
Please lint any additions to Python code with `pylint` and `flake8`:
45+
Please lint any additions to Python and JS code with `pylint`, `flake8`, `black`, `eslint`, and `prettier`:
46+
4147
```commandline
42-
flake8 --max-line-length=100 usage.py usage-advanced.py usage-elements.py usage-events.py usage-stylesheet.py
43-
flake8 --max-line-length=100 demos tests
44-
pylint usage.py usage-advanced.py usage-elements.py usage-events.py usage-stylesheet.py
45-
pylint demos tests
48+
npm run lint:all
4649
```
4750

4851
## Code quality & design
@@ -63,37 +66,41 @@ pylint demos tests
6366
* Scan your code for expensive operations (large computations, DOM queries, React re-renders). Have you done your possible to limit their impact? If not, it is going to slow your app down.
6467
* Can you think of cases where your current code will break? How are you handling errors? Should the user see them as notifications? Should your app try to auto-correct them for them?
6568

66-
6769
## Tests
6870

6971
### Running the tests
7072

7173
Activate your virtualenv:
74+
7275
```commandline
7376
source venv/bin/activate
7477
```
7578

7679
If needed, install the requirements:
80+
7781
```commandline
7882
pip install -r tests/requirements.txt
7983
```
8084

81-
Run the following tests:
85+
Install ChromeDriver following the instructions [here (Mac)](https://www.kenst.com/2015/03/installing-chromedriver-on-mac-osx/) or [here (Windows)](http://jonathansoma.com/lede/foundations-2018/classes/selenium/selenium-windows-install/). You must install the version of ChromeDriver that matches your Chrome version.
86+
87+
Run the tests using the following command:
88+
8289
```commandline
83-
python -m unittest tests.test_callbacks
84-
python -m unittest tests.test_interactions
85-
python -m unittest tests.test_usage
90+
pytest --headless
8691
```
8792

8893
Look inside the `tests/screenshots` directory to find the images created by the tests. If you have
8994
Percy configured, run the following test:
95+
9096
```commandline
9197
python -m unittest tests.test_percy_snapshot
92-
```
98+
```
9399

94100
### Percy
95101

96102
Make sure to configure your Percy environment variables correctly:
103+
97104
```commandline
98105
PERCY_BRANCH=local
99106
PERCY_ENABLED=1
@@ -103,10 +110,12 @@ PERCY_TOKEN=***************
103110
You can find the token in the [project settings of the Percy project](https://percy.io/plotly/dash-cytoscape/settings). Only members of the Plotly organizations have access to this token.
104111

105112
### About the tests
113+
106114
The tests are broken down in 3 categories:
107-
* Callbacks: Tests if the `elements`, `stylesheet` and `layout` properties can be updated correctly by other Dash components using callbacks.
108-
* Interactions: Tests user interactions such as dragging, clicking, and hovering over nodes, as well as the associated event callbacks.
109-
* Usage: Tests if all of the usage apps render correctly on start. This does not test callbacks.
115+
116+
- Callbacks: Tests if the `elements`, `stylesheet` and `layout` properties can be updated correctly by other Dash components using callbacks.
117+
- Interactions: Tests user interactions such as dragging, clicking, and hovering over nodes, as well as the associated event callbacks.
118+
- Usage: Tests if all of the usage apps render correctly on start. This does not test callbacks.
110119

111120
Those tests are rendered into images located inside `tests/screenshots`, which are then sent to a Percy build using `tests.test_percy_snapshot`, which creates a Dash app that only serves the content of `tests/screenshots` at different routes, which are then captured by the Percy runner.
112121

@@ -122,14 +131,19 @@ To publish or create a prerelease:
122131
2. Bump version numbers in `package.json`, update the [CHANGELOG](CHANGELOG.md), and make a pull request
123132
3. Once the pull request is merged into master:
124133
4. Build
134+
125135
```
126-
npm run build:backends
136+
npm run build:all
127137
```
138+
128139
5. Create distribution tarball
140+
129141
```
130142
python setup.py sdist
131143
```
144+
132145
6. Copy the tarball into a separate folder and try to install it and run the examples:
146+
133147
```
134148
cp dist/dash_cytoscape-x.x.x.tar.gz ../temp
135149
cp usage.py ../temp
@@ -138,64 +152,77 @@ source venv/bin/activate
138152
pip install dash_cytoscape-x.x.x.tar.gz
139153
python usage.py
140154
```
155+
141156
7. If the examples work, then publish:
157+
142158
```
143159
npm publish
144160
twine upload dist/dash_cytoscape-x.x.x.tar.gz
145161
```
162+
146163
8. Tag your release with git:
164+
147165
```
148166
git tag -a 'vx.x.x' -m 'vx.x.x'
149167
git push origin master --follow-tags
150168
```
169+
151170
9. Verify that the publish worked by installing it:
171+
152172
```
153173
cd ../temp
154174
pip install dash-cytoscape==x.x.x
155175
python usage.py
156176
```
157177

158-
159178
Make a post in the [Dash Community Forum](https://community.plotly.com/c/dash)
160-
* Title it `":mega: Announcement! New <Your Feature> - Feedback Welcome"`
161-
* In the description, link to the PR and any relevant issue(s)
162-
* Pin the topic so that it appears at the top of the forum for two weeks
179+
180+
- Title it `":mega: Announcement! New <Your Feature> - Feedback Welcome"`
181+
- In the description, link to the PR and any relevant issue(s)
182+
- Pin the topic so that it appears at the top of the forum for two weeks
163183

164184
## [Checklists](http://rs.io/unreasonable-effectiveness-of-checklists/)
185+
165186
**Beginner tip:** _Copy and paste this section as a comment in your PR, then check off the boxes as you go!_
187+
166188
### Pre-Merge checklist
167-
- [ ] The project was correctly built with `npm run build:backends`.
168-
- [ ] If there was any conflict, it was solved correctly
169-
- [ ] All changes were documented in CHANGELOG.md.
170-
- [ ] All tests on CircleCI have passed.
171-
- [ ] All Percy visual changes have been approved.
172-
- [ ] Two people have :dancer:'d the pull request. You can be one of these people if you are a Dash Cytoscape core contributor.
189+
190+
- [ ] The project was correctly built with `npm run build:all`.
191+
- [ ] If there was any conflict, it was solved correctly
192+
- [ ] All changes were documented in CHANGELOG.md.
193+
- [ ] All tests on CircleCI have passed.
194+
- [ ] All Percy visual changes have been approved.
195+
- [ ] Two people have :dancer:'d the pull request. You can be one of these people if you are a Dash Cytoscape core contributor.
173196

174197
### Merge step
175-
1. Make sure to *Squash and Merge* your contribution if you have created multiple commits to change a specific feature.
176-
2. Make sure to *Rebase and Merge* if you added many different features, and need to contribute multiple different commits.
198+
199+
1. Make sure to _Squash and Merge_ your contribution if you have created multiple commits to change a specific feature.
200+
2. Make sure to _Rebase and Merge_ if you added many different features, and need to contribute multiple different commits.
177201

178202
### Post-Merge checklist
179-
- [ ] You have tagged the release using `git tag v<version_number>` _(for the contributor merging the PR)_.
180-
- [ ] You have pushed this tag using `git push <tag_name>` _(for the contributor merging the PR)_.
181-
- [ ] You have deleted the branch.
203+
204+
- [ ] You have tagged the release using `git tag v<version_number>` _(for the contributor merging the PR)_.
205+
- [ ] You have pushed this tag using `git push <tag_name>` _(for the contributor merging the PR)_.
206+
- [ ] You have deleted the branch.
182207

183208
### Pre-Release checklist
184-
- [ ] Everything in the Pre-Merge checklist is completed.
185-
- [ ] `git remote show origin` shows you are in the correct repository.
186-
- [ ] `git branch` shows that you are on the expected branch.
187-
- [ ] `git status` shows that there are no unexpected changes.
188-
- [ ] Both `package.json` and `dash_cytoscape/package.json` versions have been correctly updated.
209+
210+
- [ ] Everything in the Pre-Merge checklist is completed.
211+
- [ ] `git remote show origin` shows you are in the correct repository.
212+
- [ ] `git branch` shows that you are on the expected branch.
213+
- [ ] `git status` shows that there are no unexpected changes.
214+
- [ ] Both `package.json` and `dash_cytoscape/package.json` versions have been correctly updated.
189215

190216
### Release Step
217+
191218
Complete the "Publishing" section.
192219

193220
### Post-Release checklist
194-
- [ ] Step 1 and 2 of Post-merge checklist are completed.
195-
- [ ] You have closed all issues that this pull request solves, and commented the new version number users should install.
196-
- [ ] If significant enough, you have created an issue about documenting the new feature or change and you have added it to the [Documentation] project.
197-
- [ ] You have created a pull request in [Dash Docs] with the new release of your feature by editing that project's [`requirements.txt` file](https://github.com/plotly/dash-docs/blob/master/requirements.txt).
198221

222+
- [ ] Step 1 and 2 of Post-merge checklist are completed.
223+
- [ ] You have closed all issues that this pull request solves, and commented the new version number users should install.
224+
- [ ] If significant enough, you have created an issue about documenting the new feature or change and you have added it to the [Documentation] project.
225+
- [ ] You have created a pull request in [Dash Docs] with the new release of your feature by editing that project's [`requirements.txt` file](https://github.com/plotly/dash-docs/blob/master/requirements.txt).
199226

200227
## Financial Contributions
201228

@@ -205,7 +232,7 @@ Dash, and many of Plotly's open source products, have been funded through direct
205232
[Dash HTML Components]: https://github.com/plotly/dash-html-components
206233
[write your own components]: https://dash.plotly.com/plugins
207234
[Dash Component Biolerplate]: https://github.com/plotly/dash-component-boilerplate
208-
[issues]: https://github.com/plotly/dash-core-components/issues
235+
[issues]: https://github.com/plotly/dash-core-components/issues
209236
[GitHub flow]: https://guides.github.com/introduction/flow/
210237
[eslintrc-react.json]: https://github.com/plotly/dash-components-archetype/blob/master/config/eslint/eslintrc-react.json
211238
[contributors]: https://github.com/plotly/dash-core-components/graphs/contributors

0 commit comments

Comments
 (0)