File: contributing.md

package info (click to toggle)
python-wslink 2.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,396 kB
  • sloc: python: 2,854; javascript: 1,176; cpp: 29; makefile: 3
file content (158 lines) | stat: -rw-r--r-- 4,032 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
title: Contributing
---

We welcome your contributions to the development of wslink. This document will help you with the process.

## Before You Start

Please format the code using `black` for Python and `prettier` for JavaScript. Please find below how to use them:

```
# For JavaScript
cd ./js
npm ci
npm run prettier
```

```
# For Python
black ./python
```

## Workflow

1. Fork [kitware/wslink](https://github.com/kitware/wslink).
2. Clone the repository to your computer and install dependencies.

```
$ git clone https://github.com/<username>/wslink.git
$ cd wslink/js
$ npm install
$ cd ../python
$ pip install -r requirements-dev.txt
```

3. Create a feature branch.

```
$ git checkout -b new_feature
```

4. Start hacking.
5. Test.
5. Use Commitizen for commit message

It does not matter if your changes only happened outside of the JavaScript client. Commitizen is just well integrated into JavaScript and therefore you can use it for commiting any changes.

```
$ cd ./js
$ npm run commit
```

6. Push the branch:

```
$ git push origin new_feature
```

6. Create a pull request and describe the change.

## Notice

Semantic-release [convention](https://gist.github.com/stephenparish/9941e89d80e2bc58a153) is used to write commit messages so we can automate change-log generation along with creating a new release for the JavaScript (npm) and Python (PyPI) based on your commit. No need to edit any version number, it will be automatically generated.

Unfortunately we did not managed to fully automate the testing. This means the testing will need to happen manually. Please refer to the testing checklist for running them on your system.

## Testing checklist

### Dev environment setup

```
python3 -m venv py-env
source ./py-env/bin/activate
pip install --upgrade -e ./python
```

### Build web tests

```
cd ./js
npm ci
npm run build:test
```

And

```
cd ./tests/chat-rpc-pub-sub/clients/js
npm ci
npm run build
```

### Running tests

Make sure your venv is activated (`source ./py-env/bin/activate`).

__chat-rpc-pub-sub__
```
cd ./tests/chat-rpc-pub-sub
python ./server/chat.py --port 1234 --content ./www/ --host 0.0.0.0

# Open several web clients
# => http://localhost:1234/

1. Make sure each client see the messages from any other clients
2. When n clients are connected, each message should be seen only
   once on each client.
```

__simple__
```
cd ./tests/simple
python ./server/simple.py --port 1234 --content ./www/ --host 0.0.0.0

# Open 1 web clients
# => http://localhost:1234/

Then run the following steps while having the dev console open:
1. Connect
   > WS open
2. Send Add
   > result 15
3. Send Mult
   > result 120
4. Send Image
   > result [object Blob]
   The GreenBlue Kitware logo should be visible in the page
5. Test Nesting
   In the debug console you should see `Nesting: { bytesList: [Blob, Blob], # image: { blob: Blob } }
6. Sub/Unsub
   > result [object Object]
   You should see the picture toggle between GreenBlue / ~RedPurple
7. Sub/Unsub
   > result [object Object]
   The picture update should stop
8. Mistake
   > error: -32601, "Unregistered method called", myprotocol.mistake.TYPO
9. Test NaN
   > result Infinity,NaN,-Infinity
10. Disconnect
11. Connect
    Redo 2-9
12. Server Quit
    Make sure the console running the server does not have any error
```

## Updating Documentation

The wslink documentation is part of the code repository. Feel free to update any guide `./documentation/content/docs/*.md`.

wslink's webpages are on [Github Pages](https://kitware.github.io/wslink/) and are generated using [kw-doc](https://github.com/Kitware/kw-doc). It should be automatically updated by our CI when a commit is made to the master branch. To test what website will look locally, follow those steps:

* `cd js/`
* `npm run doc:www`
    * test the docs locally

## Reporting Issues

When you encounter some problems when using wslink, you can ask me on [GitHub](https://github.com/kitware/wslink/issues). If you can't find the answer, please report it on GitHub.