summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-10-17 11:56:51 -0400
committerGitHub <noreply@github.com>2018-10-17 11:56:51 -0400
commitaad1219701140498187723b40f4da5606ace800d (patch)
tree7134a72d26ef03923dcbce6f202c9ce082de6cdc
parent91ff185bc9491e20bdb10c61e4072d14fd63ff20 (diff)
parentab09f9f59745fbc789d867bce175db254182d3cd (diff)
downloadcmd2-git-aad1219701140498187723b40f4da5606ace800d.tar.gz
Merge pull request #580 from fdiasdev/contributing-using-virtualenv
Add Env setup documentation in CONTRIBUTING
-rw-r--r--CONTRIBUTING.md42
1 files changed, 31 insertions, 11 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index d2f71e6b..c3da497c 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -180,23 +180,37 @@ $ git push origin [name_of_your_new_branch]
### Setting up for cmd2 development
-For doing cmd2 development, you actually do NOT want to have cmd2 installed as a Python package.
-So if you have previously installed cmd2, make sure to uninstall it:
+For doing cmd2 development, it is recommended you create a virutal environment using Conda or Virtualenv and install the package from the source.
+
+#### Create a new environment for cmd2 using Conda
```sh
-$ pip uninstall cmd2
+$ conda create -n cmd2_py36 python=3.6
+$ conda activate cmd2
```
-Assuming you cloned the repository to `~/src/cmd2`:
+#### Create a new environment for cmd using Virtualenv
+We recommend that you use [pyenv](https://github.com/pyenv/pyenv) to manage your installed python versions.
+
+```sh
+# Check pyenv versions installed
+pyenv versions
+
+# Install python version defined
+pyenv install 3.6.3
+```
+With the Python version installed, you can set the virutalenv properly.
+
```sh
$ cd ~/src/cmd2
-$ pip install -e .
+$ virtualenv -p $(pyenv root)/versions/3.6.3/ cmd_py36
+$ source ~/src/cmd2/bin/activate
```
-will install cmd2 in [editable mode](https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs).
+
+Assuming you cloned the repository to `~/src/cmd2` you can install cmd2 in
+[editable mode](https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs).
Changes to the source code are immediately available when the python interpreter
imports `cmd2`, there is no need to re-install the module after every change. This
-command will also install all of the runtime dependencies for `cmd2`.
-
-Next you should install all the modules used for development of `cmd2`:
+command will also install all of the runtime dependencies for `cmd2` and modules used for development of `cmd2`:
```sh
$ cd ~/src/cmd2
$ pip install -e .[dev]
@@ -229,11 +243,17 @@ have a look at `tasks.py`.
Now you can check if everything is installed and working:
```sh
$ cd ~src/cmd2
+$ invoke pytest
+```
+
+If the tests are executed it means that dependencies and project are installed succesfully.
+
+You can also run the example app and see a prompt that says "(Cmd)" running the command:
+```sh
$ python examples/example.py
```
-If the example app loads, you should see a prompt that says "(Cmd)". You can
-type `help` to get help or `quit` to quit. If you see that, then congratulations
+You can type `help` to get help or `quit` to quit. 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 of your Bash / terminal / command line
that will help identify the problem.