| Server IP : 82.208.35.60 / Your IP : 216.73.217.116 Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31 System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64 User : studiokobylisy_cz ( 1008) PHP Version : 7.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/local/share/doc/py36-pip/development/ |
Upload File : |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Getting Started — pip 19.1.1 documentation</title>
<link rel="stylesheet" href="../_static/pypa.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '19.1.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<script type="text/javascript" src="../_static/sidebar.js"></script>
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Contributing" href="contributing.html" />
<link rel="prev" title="Development" href="index.html" />
<link rel="shortcut icon" type="image/png" href="../_static/py.png" />
<script type="text/javascript" src="../_static/copybutton.js"></script>
</head>
<body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="contributing.html" title="Contributing"
accesskey="N">next</a></li>
<li class="right" >
<a href="index.html" title="Development"
accesskey="P">previous</a> |</li>
<li><img src="../_static/py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="https://pypa.io">PyPA</a> »</li>
<a href="../index.html">pip 19.1.1 documentation</a> »
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Development</a> »</li>
<li class="right">
<div class="inline-search" style="display: none" role="search">
<form class="inline-search" action="../search.html" method="get">
<input placeholder="Quick search" type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('.inline-search').show(0);</script>
|
</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="getting-started">
<h1>Getting Started<a class="headerlink" href="#getting-started" title="Permalink to this headline">¶</a></h1>
<p>We’re pleased that you are interested in working on pip.</p>
<p>This document is meant to get you setup to work on pip and to act as a guide and
reference to the the development setup. If you face any issues during this
process, please <a class="reference external" href="https://github.com/pypa/pip/issues/new?title=Trouble+with+pip+development+environment">open an issue</a> about it on the issue tracker.</p>
<div class="section" id="development-environment">
<h2>Development Environment<a class="headerlink" href="#development-environment" title="Permalink to this headline">¶</a></h2>
<p>pip uses <a class="reference external" href="https://pypi.org/project/tox">tox</a> for testing against multiple different Python environments
and ensuring reproducible environments for linting and building documentation.</p>
<p>For developing pip, you need to install <code class="docutils literal"><span class="pre">tox</span></code> on your system. Often, you can
just do <code class="docutils literal"><span class="pre">python</span> <span class="pre">-m</span> <span class="pre">pip</span> <span class="pre">install</span> <span class="pre">tox</span></code> to install and use it.</p>
</div>
<div class="section" id="running-pip-from-source-tree">
<h2>Running pip From Source Tree<a class="headerlink" href="#running-pip-from-source-tree" title="Permalink to this headline">¶</a></h2>
<p>To run the pip executable from your source tree during development, run pip
from the <code class="docutils literal"><span class="pre">src</span></code> directory:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> python src/pip --version
</pre></div>
</div>
</div>
<div class="section" id="running-tests">
<h2>Running Tests<a class="headerlink" href="#running-tests" title="Permalink to this headline">¶</a></h2>
<p>pip uses the <a class="reference external" href="https://pypi.org/project/pytest">pytest</a> test framework, <a class="reference external" href="https://pypi.org/project/mock">mock</a> and <a class="reference external" href="https://pypi.org/project/pretend">pretend</a>
for testing. These are automatically installed by tox for running the tests.</p>
<p>To run tests locally, run:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> tox -e py36
</pre></div>
</div>
<p>The example above runs tests against Python 3.6. You can also use other
versions like <code class="docutils literal"><span class="pre">py27</span></code> and <code class="docutils literal"><span class="pre">pypy3</span></code>.</p>
<p><code class="docutils literal"><span class="pre">tox</span></code> has been configured to any additional arguments it is given to
<code class="docutils literal"><span class="pre">pytest</span></code>. This enables the use of pytest’s <a class="reference external" href="https://docs.pytest.org/en/latest/usage.html#specifying-tests-selecting-tests">rich CLI</a>. As an example, you
can select tests using the various ways that pytest provides:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> <span class="c1"># Using file name</span>
<span class="gp">$</span> tox -e py36 -- tests/functional/test_install.py
<span class="gp">$</span> <span class="c1"># Using markers</span>
<span class="gp">$</span> tox -e py36 -- -m unit
<span class="gp">$</span> <span class="c1"># Using keywords</span>
<span class="gp">$</span> tox -e py36 -- -k <span class="s2">"install and not wheel"</span>
</pre></div>
</div>
<p>Running pip’s test suite requires supported version control tools (subversion,
bazaar, git, and mercurial) to be installed. If you are missing one of the VCS
tools, you can tell pip to skip those tests:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> tox -e py36 -- -k <span class="s2">"not svn"</span>
<span class="gp">$</span> tox -e py36 -- -k <span class="s2">"not (svn or git)"</span>
</pre></div>
</div>
</div>
<div class="section" id="running-linters">
<h2>Running Linters<a class="headerlink" href="#running-linters" title="Permalink to this headline">¶</a></h2>
<p>pip uses <a class="reference external" href="https://pypi.org/project/flake8">flake8</a> and <a class="reference external" href="https://pypi.org/project/isort">isort</a> for linting the codebase. These
ensure that the codebase is in compliance with <span class="target" id="index-0"></span><a class="pep reference external" href="https://www.python.org/dev/peps/pep-0008"><strong>PEP 8</strong></a> and the imports are
consistently ordered and styled.</p>
<p>To use linters locally, run:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> tox -e lint-py2
<span class="gp">$</span> tox -e lint-py3
</pre></div>
</div>
<p>The above commands run the linters on Python 2 followed by Python 3.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Do not silence errors from flake8 with <code class="docutils literal"><span class="pre">#</span> <span class="pre">noqa</span></code> comments or otherwise.</p>
</div>
</div>
<div class="section" id="running-mypy">
<h2>Running mypy<a class="headerlink" href="#running-mypy" title="Permalink to this headline">¶</a></h2>
<p>pip uses <a class="reference external" href="https://pypi.org/project/mypy">mypy</a> to run static type analysis, which helps catch certain
kinds of bugs. The codebase uses <a class="reference external" href="https://www.python.org/dev/peps/pep-0484/#suggested-syntax-for-python-2-7-and-straddling-code">PEP 484 type-comments</a> due to compatibility
requirements with Python 2.7.</p>
<p>To run the <code class="docutils literal"><span class="pre">mypy</span></code> type checker, run:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> tox -e mypy
</pre></div>
</div>
</div>
<div class="section" id="building-documentation">
<h2>Building Documentation<a class="headerlink" href="#building-documentation" title="Permalink to this headline">¶</a></h2>
<p>pip’s documentation is built using <a class="reference external" href="https://pypi.org/project/Sphinx">Sphinx</a>. The documentation is written
in reStructuredText.</p>
<p>To build it locally, run:</p>
<div class="highlight-console"><div class="highlight"><pre><span></span><span class="gp">$</span> tox -e docs
</pre></div>
</div>
<p>The built documentation can be found in the <code class="docutils literal"><span class="pre">docs/build</span></code> folder.</p>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../quickstart.html">Quickstart</a></li>
<li class="toctree-l1"><a class="reference internal" href="../installing.html">Installation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../user_guide.html">User Guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../reference/index.html">Reference Guide</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Development</a><ul class="current">
<li class="toctree-l2 current"><a class="current reference internal" href="#">Getting Started</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#development-environment">Development Environment</a></li>
<li class="toctree-l3"><a class="reference internal" href="#running-pip-from-source-tree">Running pip From Source Tree</a></li>
<li class="toctree-l3"><a class="reference internal" href="#running-tests">Running Tests</a></li>
<li class="toctree-l3"><a class="reference internal" href="#running-linters">Running Linters</a></li>
<li class="toctree-l3"><a class="reference internal" href="#running-mypy">Running mypy</a></li>
<li class="toctree-l3"><a class="reference internal" href="#building-documentation">Building Documentation</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="contributing.html">Contributing</a></li>
<li class="toctree-l2"><a class="reference internal" href="release-process.html">Release process</a></li>
<li class="toctree-l2"><a class="reference internal" href="vendoring-policy.html">Vendoring Policy</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../news.html">Release Notes</a></li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="index.html"
title="previous chapter">Development</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="contributing.html"
title="next chapter">Contributing</a></p>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="contributing.html" title="Contributing"
>next</a></li>
<li class="right" >
<a href="index.html" title="Development"
>previous</a> |</li>
<li><img src="../_static/py.png" alt=""
style="vertical-align: middle; margin-top: -1px"/></li>
<li><a href="https://pypa.io">PyPA</a> »</li>
<a href="../index.html">pip 19.1.1 documentation</a> »
<li class="nav-item nav-item-1"><a href="index.html" >Development</a> »</li>
<li class="right">
<div class="inline-search" style="display: none" role="search">
<form class="inline-search" action="../search.html" method="get">
<input placeholder="Quick search" type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('.inline-search').show(0);</script>
|
</li>
</ul>
</div>
<div class="footer">
© <a href="../copyright.html">Copyright</a> 2008-2017, PyPA.
<br />
The Python Software Foundation is a non-profit corporation.
<a href="https://www.python.org/psf/donations/">Please donate.</a>
<br />
<br />
Last updated on Nov 14, 2019.
<a href="https://github.com/pypa/pip/issues">Found a bug</a>?
<br />
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.6.5.
</div>
</body>
</html>