Installation
Installing from prepackaged binaries
Stable releases of contourpy
are available from PyPI, conda-forge, and Anaconda
default channels for Linux, macOS and Windows.
To install from PyPI:
$ pip install contourpy
To install from conda-forge:
$ conda install -c conda-forge contourpy
To install from Anaconda default channel:
$ conda install contourpy
The only compulsory runtime dependency is NumPy.
If you want to make use of one of contourpy’s utility renderers in the contourpy.util
module
you will also have to install either Matplotlib or Bokeh.
Installing from source
The source code for contourpy
is available from github.
Either git clone
it directly, or fork and git clone
it from your fork, as usual.
Note
You should install contourpy
from source into a new virtual environment using conda
or
venv
for example.
To use venv
to create a new virtual environment in a directory called .venv/contourpy
and activate it:
$ python -m venv ~/.venv/contourpy
$ . ~/.venv/contourpy/bin/activate
From the base directory of your local contourpy
git repo, build and install it in editable mode
using:
$ pip install -ve .
To build in debug mode, which enables assert
statements in the C++ code, use the
CONTOURPY_DEBUG
environment variable:
$ CONTOURPY_DEBUG=1 pip install -ve .
Running tests
To run the test suite, first ensure that the required dependencies are installed and then run the
tests using pytest
:
$ pip install -ve .[test]
$ pytest
It is possible to exclude certain tests. To exclude image comparison tests, for example if you do
not have matplotlib
installed:
$ pytest -k "not image"
To exclude threaded tests:
$ pytest -k "not threads"
Other tests are excluded by default but can be manually enabled. To include tests that generate text output:
$ pytest --runtext
but note that the output depends on the version of freetype
that matplotlib
is compiled
against. To include tests that take a long time to run:
$ pytest --runslow
Building the documentation
To build the documentation:
$ pip install -ve .[docs]
$ cd docs
$ make html
Warning
If you modify some of the C++ source code and wish to ensure a completely clean build, you can first use:
$ git clean -fxd
although use this with care as it will also delete any new files that you have created that have
not been added to git
and are not mentioned in the .gitignore
file.