The pip tool can search for packages in a central repository — the Python Package Index, or PyPI, also known by the nickname "Cheeseshop" — and then download and install them along with their dependencies. You can browse the PyPI at https://pypi.python.org/pypi. This is an extremely convenient way to install Python software, so it’s good to understand how to use it.
We'll demonstrate how to use pip by installing the nose testing tool. The nose
command is a sort of power-tool for running unittest
based tests such as those we developed in Chapter 10, Unit testing with the Python standard library. One really useful thing it can do is discover all of your tests and run them. This means that you don't need to add unittest.main()
into your code; you can just use nose
to find and run your tests.
First though, we need to do some groundwork. Let's create a virtual environment (see Appendix B, Pakaging and Distribution) so we don't inadvertently install into...