Hack
Ready to contribute? Here’s how to set up Watson for local development.
Python requirements
- Python (2/3) interpreter installed
pip
tool to install package dependenciesvirtualenv
tool to create virtual environments
Get started!
-
Fork the Watson repository on GitHub.
-
Clone your fork locally:
$ git clone git@github.com:your_name_here/Watson.git
-
Create a virtual environment:
$ cd Watson $ make env
The Python version used will be the one accessible using the
python
command in your shell.To use a different Python version, define the
PYTHON
shell variable. For example:$ PYTHON=python3.5 make env
-
Install dependencies and deploy Watson inside the virtual environment:
$ source .venv/bin/activate (.venv) $ make install-dev
If you are using fish shell, source
.venv/bin/activate.fish
instead. -
Create a branch for local development:
(.venv) $ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
Notes:
- The files you need to edit to change watson’s behavior are located in the
watson/
subfolder. - Every time you run
watson
inside the virtual environment, the source code inside thewatson/
subfolder will be used. - To avoid messing with your real Watson data, watson will use
data/
as the application folder inside the virtual environment. You can runwatson projects
to check that your real projects are not shown.
- The files you need to edit to change watson’s behavior are located in the
-
When you’re done making changes, check that your changes pass the tests (see Run the tests):
(.venv) $ tox
-
If you have added a new command or updated/fixed docstrings, please update the documentation:
(.venv) $ make docs
-
Commit your changes and push your branch to GitHub:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push -u origin name-of-your-bugfix-or-feature
-
After reading this, submit a pull request through the GitHub website.
Run the tests
The tests use pytest. To run them with the default Python interpreter:
$ py.test -v tests/
To run the tests via tox with all Python versions
which are available on your system and are defined in the tox.ini
file,
simply run:
$ tox
This will also check the source code with flake8.