Skip to content

Commit fc5dcf4

Browse files
committed
DOC: reorganize and simplify contributing.rst
- only provide one installation direction - put details about local testing at the top
1 parent dba5232 commit fc5dcf4

File tree

1 file changed

+35
-29
lines changed

1 file changed

+35
-29
lines changed

doc/devel/contributing.rst

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,44 +21,62 @@ also welcome to post feature requests or pull requests.
2121
Retrieving and installing the latest version of the code
2222
========================================================
2323

24+
When working on the Matplotlib source, setting up a `virtual
25+
environment
26+
<http://docs.python-guide.org/en/latest/dev/virtualenvs/>`_ or a
27+
`conda environment <http://conda.pydata.org/docs/using/envs.html>`_ is
28+
recommended.
29+
30+
.. warning::
31+
32+
If you already have a version of matplotlib installed, you will need to
33+
uninstall it.
2434

2535
We use `Git <https://git-scm.com/>`_ for version control and
2636
`GitHub <https://github.com/>`_ for hosting our main repository.
2737

28-
You can check out the latest sources with the command::
38+
You can check out the latest sources with the command (see
39+
:ref:`set-up-fork` for more details)::
2940

3041
git clone git@github.com:matplotlib/matplotlib.git
3142

43+
and navigate to the matplotlib directory.
3244

33-
After obtaining a local copy of the matplotlib source code (:ref:`set-up-fork`),
34-
navigate to the matplotlib directory and run the following in the shell::
45+
To make sure the tests run locally you must build against the correct version
46+
of freetype. To configure the build system to fetch and build it either export
47+
the env ``MPLLOCALFREETYPE`` as::
3548

36-
python setup.py develop
49+
export MPLLOCALFREETYPE=1
3750

38-
or::
51+
or copy :file:`setup.cfg.template` to :file:`setup.cfg` and edit to contain ::
3952

40-
pip install -v -e .
53+
[test]
54+
local_freetype = True
4155

4256

43-
This installs matplotlib for development (i.e., builds everything and places the
44-
symbolic links back to the source code).
57+
To install Matplotlib (and compile the c-extensions) run the following
58+
command from the top-level directory ::
4559

46-
.. warning::
60+
pip install -v -e ./
4761

48-
If you already have a version of matplotlib installed, you will need to
49-
uninstall it.
62+
This installs Matplotlib in 'editable/develop mode', i.e.,
63+
builds everything and places symbolic links back to the source code
64+
from the install directory. Thus, any changes to the ``*.py`` files
65+
will be reflected the next time you import the library. If you change
66+
the c-extension source (which might happen if you change branches) you
67+
will need to run::
5068

69+
python setup.py build
5170

52-
.. note::
71+
or re-run ``pip install -v -e ./``.
5372

54-
If you decide to do install with ``python setup.py develop`` or ``pip
55-
install -v -e``, you will have to rerun::
5673

57-
python setup.py build
74+
Alternatively, if you do ::
5875

59-
every time the source code of a compiled extension is changed (for
60-
instance when switching branches or pulling changes from upstream).
76+
pip install -v ./
6177

78+
all of the files will be copied to the installation directory however,
79+
you will have to rerun this command every time the source is changed.
6280

6381

6482
You can then run the tests to check your work environment is set up properly::
@@ -75,18 +93,6 @@ You can then run the tests to check your work environment is set up properly::
7593
<https://docs.python.org/dev/library/unittest.mock.html>`_ (if python < 3.3), `Ghostscript
7694
<https://www.ghostscript.com/>`_, `Inkscape <https://inkscape.org>`_
7795

78-
.. note:: To make sure the tests run locally:
79-
80-
* Copy setup.cfg.template to setup.cfg
81-
* Edit setup.cfg to set ``test`` to True, and ``local_freetype`` to True
82-
* If you have built matplotlib previously, remove the ``build`` folder.
83-
* Execute the build command.
84-
85-
When working on bleeding edge packages, setting up a
86-
`virtual environment
87-
<http://docs.python-guide.org/en/latest/dev/virtualenvs/>`_ or a `conda
88-
environment <http://conda.pydata.org/docs/using/envs.html>`_ is recommended.
89-
9096
.. seealso::
9197

9298
* :ref:`testing`

0 commit comments

Comments
 (0)