Skip to content

Commit 97b9577

Browse files
authored
Merge pull request matplotlib#23823 from timhoffm/doc-dev-setup
[DOC] Improve dev setup description
2 parents 3b79f63 + c58a1ca commit 97b9577

File tree

1 file changed

+38
-37
lines changed

1 file changed

+38
-37
lines changed

doc/devel/development_setup.rst

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@
44
Setting up Matplotlib for development
55
=====================================
66

7-
Retrieving the latest version of the code
8-
=========================================
7+
To set up Matplotlib for development follow these steps:
8+
9+
.. contents::
10+
:local:
11+
12+
Retrieve the latest version of the code
13+
=======================================
914

1015
Matplotlib is hosted at https://github.com/matplotlib/matplotlib.git.
1116

@@ -15,64 +20,60 @@ You can retrieve the latest sources with the command (see
1520
git clone https://github.com/matplotlib/matplotlib.git
1621

1722
This will place the sources in a directory :file:`matplotlib` below your
18-
current working directory.
23+
current working directory. Change into this directory::
24+
25+
cd matplotlib
1926

2027
If you have the proper privileges, you can use ``git@`` instead of
2128
``https://``, which works through the ssh protocol and might be easier to use
2229
if you are using 2-factor authentication.
2330

2431
.. _dev-environment:
2532

26-
Creating a dedicated environment
27-
================================
33+
Create a dedicated environment
34+
==============================
2835
You should set up a dedicated environment to decouple your Matplotlib
2936
development from other Python and Matplotlib installations on your system.
3037

31-
Using virtual environments
32-
--------------------------
33-
34-
Here we use python's virtual environment `venv`_, but you may also use others
35-
such as conda.
38+
The simplest way to do this is to use either Python's virtual environment
39+
`venv`_ or `conda`_.
3640

3741
.. _venv: https://docs.python.org/3/library/venv.html
42+
.. _conda: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
3843

39-
A new environment can be set up with ::
44+
.. tab-set::
4045

41-
python -m venv <file folder location>
46+
.. tab-item:: venv environment
4247

43-
and activated with one of the following::
48+
Create a new `venv`_ environment with ::
4449

45-
source <file folder location>/bin/activate # Linux/macOS
46-
<file folder location>\Scripts\activate.bat # Windows cmd.exe
47-
<file folder location>\Scripts\Activate.ps1 # Windows PowerShell
50+
python -m venv <file folder location>
4851

49-
Whenever you plan to work on Matplotlib, remember to activate the development
50-
environment in your shell.
52+
and activate it with one of the following ::
5153

52-
Conda dev environment
53-
---------------------
54-
After you have cloned the repo change into the matplotlib directory.
54+
source <file folder location>/bin/activate # Linux/macOS
55+
<file folder location>\Scripts\activate.bat # Windows cmd.exe
56+
<file folder location>\Scripts\Activate.ps1 # Windows PowerShell
5557

56-
A new conda environment can be set-up with::
58+
.. tab-item:: conda environment
5759

58-
conda env create -f environment.yml
60+
Create a new `conda`_ environment with ::
5961

60-
Note that if you have mamba installed you can replace conda with mamba in
61-
the above command.
62+
conda env create -f environment.yml
6263

63-
To activate your environment::
64+
You can use ``mamba`` instead of ``conda`` in the above command if
65+
you have `mamba`_ installed.
6466

65-
conda activate mpl-dev
67+
.. _mamba: https://mamba.readthedocs.io/en/latest/
6668

67-
Finish the install by the following command::
69+
Activate the environment using ::
6870

69-
pip install -e .
71+
conda activate mpl-dev
7072

71-
Whenever you plan to work on Matplotlib, remember to ``conda activate mpl-dev``
72-
in your shell.
73+
Remember to activate the environment whenever you start working on Matplotlib.
7374

74-
Installing Matplotlib in editable mode
75-
======================================
75+
Install Matplotlib in editable mode
76+
===================================
7677
Install Matplotlib in editable mode from the :file:`matplotlib` directory
7778
using the command ::
7879

@@ -86,8 +87,8 @@ true for ``*.py`` files. If you change the C-extension source (which might
8687
also happen if you change branches) you will have to re-run
8788
``python -m pip install -ve .``
8889

89-
Installing pre-commit hooks
90-
===========================
90+
Install pre-commit hooks (optional)
91+
===================================
9192
You can optionally install `pre-commit <https://pre-commit.com/>`_ hooks.
9293
These will automatically check flake8 and other style issues when you run
9394
``git commit``. The hooks are defined in the top level
@@ -105,6 +106,6 @@ To run a particular hook manually, run ``pre-commit run`` with the hook id ::
105106

106107
pre-commit run <hook id> --all-files
107108

108-
Installing additional dependencies for development
109-
==================================================
109+
Install additional development dependencies
110+
===========================================
110111
See :ref:`development-dependencies`.

0 commit comments

Comments
 (0)