4
4
Setting up Matplotlib for development
5
5
=====================================
6
6
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
+ =======================================
9
14
10
15
Matplotlib is hosted at https://github.com/matplotlib/matplotlib.git.
11
16
@@ -15,64 +20,60 @@ You can retrieve the latest sources with the command (see
15
20
git clone https://github.com/matplotlib/matplotlib.git
16
21
17
22
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
19
26
20
27
If you have the proper privileges, you can use ``git@ `` instead of
21
28
``https:// ``, which works through the ssh protocol and might be easier to use
22
29
if you are using 2-factor authentication.
23
30
24
31
.. _dev-environment :
25
32
26
- Creating a dedicated environment
27
- ================================
33
+ Create a dedicated environment
34
+ ==============================
28
35
You should set up a dedicated environment to decouple your Matplotlib
29
36
development from other Python and Matplotlib installations on your system.
30
37
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 `_.
36
40
37
41
.. _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
38
43
39
- A new environment can be set up with ::
44
+ .. tab- set ::
40
45
41
- python -m venv <file folder location>
46
+ .. tab-item :: venv environment
42
47
43
- and activated with one of the following ::
48
+ Create a new ` venv `_ environment with ::
44
49
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>
48
51
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 ::
51
53
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
55
57
56
- A new conda environment can be set-up with::
58
+ .. tab-item :: conda environment
57
59
58
- conda env create -f environment.yml
60
+ Create a new ` conda `_ environment with ::
59
61
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
62
63
63
- To activate your environment::
64
+ You can use ``mamba `` instead of ``conda `` in the above command if
65
+ you have `mamba `_ installed.
64
66
65
- conda activate mpl-dev
67
+ .. _ mamba : https://mamba.readthedocs.io/en/latest/
66
68
67
- Finish the install by the following command ::
69
+ Activate the environment using ::
68
70
69
- pip install -e .
71
+ conda activate mpl-dev
70
72
71
- Whenever you plan to work on Matplotlib, remember to ``conda activate mpl-dev ``
72
- in your shell.
CE69
73
+ Remember to activate the environment whenever you start working on Matplotlib.
73
74
74
- Installing Matplotlib in editable mode
75
- ======================================
75
+ Install Matplotlib in editable mode
76
+ ===================================
76
77
Install Matplotlib in editable mode from the :file: `matplotlib ` directory
77
78
using the command ::
78
79
@@ -86,8 +87,8 @@ true for ``*.py`` files. If you change the C-extension source (which might
86
87
also happen if you change branches) you will have to re-run
87
88
``python -m pip install -ve . ``
88
89
89
- Installing pre-commit hooks
90
- ===========================
90
+ Install pre-commit hooks (optional)
91
+ ===================================
91
92
You can optionally install `pre-commit <https://pre-commit.com/ >`_ hooks.
92
93
These will automatically check flake8 and other style issues when you run
93
94
``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 ::
105
106
106
107
pre-commit run <hook id> --all-files
107
108
108
- Installing additional dependencies for development
109
- ==================================================
109
+ Install additional development dependencies
110
+ ===========================================
110
111
See :ref: `development-dependencies `.
0 commit comments