<spanid="installing-for-devs"></span><h1>Setting up Matplotlib for development<aclass="headerlink" href="#setting-up-matplotlib-for-development" title="Permalink to this heading">#</a></h1>
<p>To set up Matplotlib for development follow these steps:</p>
<navclass="contents local" id="contents">
<ulclass="simple">
<li><p><aclass="reference internal" href="#retrieve-the-latest-version-of-the-code" id="id1">Retrieve the latest version of the code</a></p></li>
<li><p><aclass="reference internal" href="#create-a-dedicated-environment" id="id2">Create a dedicated environment</a></p></li>
<li><p><aclass="reference internal" href="#install-matplotlib-in-editable-mode" id="id3">Install Matplotlib in editable mode</a></p></li>
<li><p><aclass="reference internal" href="#install-additional-development-dependencies" id="id4">Install additional development dependencies</a></p></li>
<h2><aclass="toc-backref" href="#id1" role="doc-backlink">Retrieve the latest version of the code</a><aclass="headerlink" href="#retrieve-the-latest-version-of-the-code" title="Permalink to this heading">#</a></h2>
<p>Matplotlib is hosted at <aclass="reference external" href="https://github.com/matplotlib/matplotlib.git">https://github.com/matplotlib/matplotlib.git</a>.</p>
<p>You can retrieve the latest sources with the command (see
<aclass="reference internal" href="gitwash/set_up_fork.html#set-up-fork"><spanclass="std std-ref">Set up your fork</span></a> for more details)</p>
<p>This requires you to setup an <aclass="reference external" href="https://docs.github.com/en/authentication/connecting-to-github-with-ssh">SSH key</a> in advance, but saves you from
typing your password at every connection.</p>
</div>
</div>
<p>This will place the sources in a directory <codeclass="file docutils literal notranslate"><spanclass="pre">matplotlib</span></code> below your
current working directory. Change into this directory:</p>
<spanid="dev-environment"></span><h2><aclass="toc-backref" href="#id2" role="doc-backlink">Create a dedicated environment</a><aclass="headerlink" href="#create-a-dedicated-environment" title="Permalink to this heading">#</a></h2>
<p>You should set up a dedicated environment to decouple your Matplotlib
development from other Python and Matplotlib installations on your system.</p>
<p>The simplest way to do this is to use either Python's virtual environment
<aclass="reference external" href="https://docs.python.org/3/library/venv.html">venv</a> or <aclass="reference external" href="https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html">conda</a>.</p>
<spanclass="o"><</span><spanclass="n">file</span><spanclass="n">folder</span><spanclass="n">location</span><spanclass="o">></span>\<spanclass="n">Scripts</span>\<spanclass="n">activate</span><spanclass="o">.</span><spanclass="n">bat</span><spanclass="c1"># Windows cmd.exe</span>
<spanclass="o"><</span><spanclass="n">file</span><spanclass="n">folder</span><spanclass="n">location</span><spanclass="o">></span>\<spanclass="n">Scripts</span>\<spanclass="n">Activate</span><spanclass="o">.</span><spanclass="n">ps1</span><spanclass="c1"># Windows PowerShell</span>
<p>Create a new <aclass="reference external" href="https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html">conda</a> environment with</p>
<p>You can use <codeclass="docutils literal notranslate"><spanclass="pre">mamba</span></code> instead of <codeclass="docutils literal notranslate"><spanclass="pre">conda</span></code> in the above command if
you have <aclass="reference external" href="https://mamba.readthedocs.io/en/latest/">mamba</a> installed.</p>
<p>Remember to activate the environment whenever you start working on Matplotlib.</p>
</section>
<sectionid="install-matplotlib-in-editable-mode">
<h2><aclass="toc-backref" href="#id3" role="doc-backlink">Install Matplotlib in editable mode</a><aclass="headerlink" href="#install-matplotlib-in-editable-mode" title="Permalink to this heading">#</a></h2>
<p>Install Matplotlib in editable mode from the <codeclass="file docutils literal notranslate"><spanclass="pre">matplotlib</span></code> directory
<h2><aclass="toc-backref" href="#id4" role="doc-backlink">Install additional development dependencies</a><aclass="headerlink" href="#install-additional-development-dependencies" title="Permalink to this heading">#</a></h2>
<p>See <aclass="reference internal" href="dependencies.html#development-dependencies"><spanclass="std std-ref">Dependencies for building Matplotlib</span></a>.</p>
</section>
<sectionid="install-pre-commit-hooks-optional">
<h2><aclass="toc-backref" href="#id5" role="doc-backlink">Install pre-commit hooks (optional)</a><aclass="headerlink" href="#install-pre-commit-hooks-optional" title="Permalink to this heading">#</a></h2>
<p><aclass="reference external" href="https://pre-commit.com/">pre-commit</a> hooks automatically check flake8 and
other style issues when you run <codeclass="docutils literal notranslate"><spanclass="pre">git</span><spanclass="pre">commit</span></code>. The hooks are defined in the
top level <codeclass="docutils literal notranslate"><spanclass="pre">.pre-commit-config.yaml</span></code> file. To install the hooks</p>
<p>To run a particular hook manually, run <codeclass="docutils literal notranslate"><spanclass="pre">pre-commit</span><spanclass="pre">run</span></code> with the hook id</p>
<!-- Scripts loaded after <body> so the DOM is not blocked -->
<divid="unreleased-message"> You are reading an old version of the documentation (v3.6.0). For the latest version see <ahref="https://matplotlib.org/stable/devel/development_setup.html">https://matplotlib.org/stable/devel/development_setup.html</a></div>