Contributing to Pip2¶
Contributing with Code¶
Supported Python Versions¶
Pip2 currently only supports Python 3.2.
The following tools are required:
- Python 3.2
- pip and virtualenv
You must also have a Github account and basic familiarity with the tools listed above.
These instructions assume a Unix-like operating system (e.g., Mac or Linux). Minor modifications may be required for contributing to pip2 on Windows.
Forking the Repository¶
$ git clone https://github.com/<YOUR_USER_NAME>/pip2
Create and activate a virtualenv for pip2 development. For example:
$ virtualenv --python=python3.2 pip2-dev $ source pip2-dev/bin/activate
$ pip install http://hg.python.org/distutils2/archive/python3.tar.bz2
$ cd pip2/ $ python setup.py develop
Running the Tests¶
$ pip install nose
Mock has been included in Python’s standard library since version 3.3. For versions of Python prior to 3.3:
$ pip install mock
Now, run the unit tests from the root directory of the pip2 repository. You should run these tests frequently as you are modifying the code:
If the coverage module is installed (pip install coverage), options may be provided to nose so that coverage data is generated:
$ nosetests --with-coverage
Usually only coverage data for pip2 will be needed. To run the coverage tool on just the pip2 package:
$ nosetests --with-coverage --cover-package=pip2
To generate HTML coverage data in the ./cover/ directory:
$ nosetests --with-coverage --cover-package=pip2 --cover-html
Once your changes are working well in your development environment, tox can be used to run these same tests in a clean environment under multiple versions of Python. First, install tox:
$ pip install tox
The first time you run it, tox will take a while (quite a few minutes) to build virtualenvs and install the required packages:
Subsequent tox runs will reuse the existing virtualenvs and run much faster. Note, however, that you may want to occasionally force the virtualenvs to be recreated by running tox –recreate to get the latest versions of pip2’s dependencies. Run tox –help, visit tox’s website, or view the tox.ini file in pip2’s repository for additional information on using tox.