You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
##### If you need more help with branching, take a look at _[this](https://github.com/Kunena/Kunena-Forum/wiki/Create-a-new-branch-with-git-and-manage-branches)_.
177
178
178
-
### Setup Linting
179
-
180
-
You should have some sort of [PEP8](https://www.python.org/dev/peps/pep-0008/)-based linting running in your editor or IDE or at the command-line before you commit code. [pylint](https://www.pylint.org) is a good Python linter which can be run at the command-line but also can integrate with many IDEs and editors.
181
-
182
-
> Please do not ignore any linting errors in code you write or modify, as they are meant to **help** you and to ensure a clean and simple code base. Don't worry about linting errors in code you don't touch though - cleaning up the legacy code is a work in progress.
183
-
184
179
185
180
### Setup for cmd2 development
186
-
Once you have cmd2 cloned, before you start any cmd2 application, you first need to install all of the dependencies:
187
-
188
-
```bash
189
-
# Install cmd2 prerequisites
190
-
pip install -U pyperclip
191
-
192
-
# Install prerequisites for running cmd2 unit tests
193
-
pip install -U pytest
194
-
195
-
# Install prerequisites for building cmd2 documentation
196
-
pip install -U sphinx sphinx-rtd-theme
197
-
198
-
# Install optional prerequisites for doing code coverage analysis
199
-
pip install -U pytest-cov
200
-
```
201
-
202
-
For doing cmd2 development, you actually do NOT want to have cmd2 installed as a Python package.
181
+
For doing cmd2 development, you actually do NOT want to have cmd2 installed as a Python package.
203
182
So if you have previously installed cmd2, make sure to uninstall it:
204
183
```bash
205
184
pip uninstall cmd2
206
185
```
207
186
208
-
Then you should modify your PYTHONPATH environment variable to include the directory you have cloned the cmd2 repository to.
209
-
Add a line similar to the following to your .bashrc, .bashprofile, or to your Windows environment variables:
210
-
187
+
Assuming you cloned the repository to `~/src/cmd2`:
211
188
```bash
212
-
# Use cmd2 Python module from GitHub clone when it isn't installed
213
-
export PYTHONPATH=$PYTHONPATH:~/src/cmd2
189
+
$ cd~/src/cmd2
190
+
$ pip install -e .
214
191
```
192
+
will install cmd2 in [editable mode](https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs).
193
+
Changes to the source code are immediately available when the python interpreter
194
+
imports `cmd2`, there is no need to re-install the module after every change. This
195
+
command will also install all of the runtime dependencies for `cmd2`.
215
196
216
-
Where `~src/cmd2` is replaced by the directory you cloned your fork of the cmd2 repo to.
197
+
Next you should install all the modules used for development of `cmd2`:
198
+
```bash
199
+
$ cd~/src/cmd2
200
+
$ pip install -e .[dev]
201
+
```
217
202
218
-
Now navigate to your terminal to the directory you cloned your fork of the cmd2 repo to and
219
-
try running the example to make sure everything is working:
203
+
This will install `pytest` and `tox` for running unit tests, `pylint` for
204
+
static code analysis, and `sphinx` for building the documentation.
220
205
206
+
Now you can check if everything is installed and working:
221
207
```bash
222
208
cd~src/cmd2
223
209
python examples/example.py
224
210
```
225
211
226
-
If the example app loads, you should see a prompt that says "(Cmd)". You can type `help` to get help or `quit` to quit.
227
-
If you see that, then congratulations – you're all set. Otherwise, refer to the cmd2 [Installation Instructions](https://cmd2.readthedocs.io/en/latest/install.html#installing). There also might be an error in the console
228
-
of your Bash / Terminal / Command Line that will help identify the problem.
212
+
If the example app loads, you should see a prompt that says "(Cmd)". You can
213
+
type `help` to get help or `quit` to quit. If you see that, then congratulations
214
+
– you're all set. Otherwise, refer to the cmd2 [Installation Instructions](https://cmd2.readthedocs.io/en/latest/install.html#installing).
215
+
There also might be an error in the console of your Bash / Terminal / Command Line
216
+
that will help identify the problem.
229
217
230
218
### Make Changes
231
219
This bit is up to you!
@@ -246,17 +234,20 @@ make clean html
246
234
```
247
235
In order to see the changes, use your web browser of choice to open `<cmd2>/docs/_build/html/index.html`.
248
236
237
+
### Static Code Analysis
238
+
239
+
You should have some sort of [PEP8](https://www.python.org/dev/peps/pep-0008/)-based linting running in your editor or IDE or at the command-line before you commit code. [pylint](https://www.pylint.org) is a good Python linter which can be run at the command-line but also can integrate with many IDEs and editors.
240
+
241
+
> Please do not ignore any linting errors in code you write or modify, as they are meant to **help** you and to ensure a clean and simple code base. Don't worry about linting errors in code you don't touch though - cleaning up the legacy code is a work in progress.
242
+
249
243
### Run The Test Suite
250
244
When you're ready to share your code, run the test suite:
251
-
252
245
```shell
253
246
cd<cmd2>
254
247
py.test
255
248
```
256
-
257
249
and ensure all tests pass.
258
250
259
-
260
251
#### Measuring code coverage
261
252
262
253
Code coverage can be measured as follows:
@@ -381,7 +372,7 @@ how to do it.
381
372
382
373
7. Creating the PR causes our continuous integration (CI) systems to automatically run all of the
383
374
unit tests on all supported OSes and all supported versions of Python. You should watch your PR
384
-
to make sure that all unit tests pass on Both TravisCI (Linux) and AppVeyor (Windows).
375
+
to make sure that all unit tests pass on Both TravisCI (Linux) and AppVeyor (Windows).
385
376
386
377
8. If any unit tests fail, you should look at the details and fix the failures. You can then push
387
378
the fix to the same branch in your fork and the PR will automatically get updated and the CI system
@@ -395,7 +386,7 @@ integration (CI) providers to automatically run all of the unit tests on multipl
395
386
396
387
1. If your changes can merge without conflicts and all unit tests pass for all OSes and supported versions of Python,
397
388
then your pull request (PR) will have a big green checkbox which says something like "All Checks Passed" next to it.
398
-
If this is not the case, there will be a link you can click on to get details regarding what the problem is.
389
+
If this is not the case, there will be a link you can click on to get details regarding what the problem is.
399
390
It is your responsibility to make sure all unit tests are passing. Generally a Maintainer will not QA a
400
391
pull request unless it can merge without conflicts and all unit tests pass on all supported platforms.
401
392
@@ -460,9 +451,9 @@ Here is some advice regarding what makes a good pull request (PR) from the persp
460
451
- Code coverage of the unit tests matters, try not to decrease it
461
452
- Think twice before adding dependencies to 3rd party libraries (outside of the Python standard library) because it could affect a lot of users
462
453
463
-
### Developing and Debugging in an IDE
454
+
### Developing in an IDE
464
455
465
-
We recommend using [Visual Studio Code](https://code.visualstudio.com) with the [Python extension](https://code.visualstudio.com/docs/languages/python) and it's [Integrated Terminal](https://code.visualstudio.com/docs/python/debugging) debugger for debugging since it has
456
+
We recommend using [Visual Studio Code](https://code.visualstudio.com) with the [Python extension](https://code.visualstudio.com/docs/languages/python) and it's [Integrated Terminal](https://code.visualstudio.com/docs/python/debugging) debugger for debugging since it has
466
457
excellent support for debugging console applications.
467
458
468
459
[PyCharm](https://www.jetbrains.com/pycharm/) is also quite good and has very nice [Code Inspection](https://www.jetbrains.com/help/pycharm/code-inspection.html) capabilities.
0 commit comments