docs: use autonumbered examples in docs

This commit is contained in:
Xavier Fernandez 2016-05-16 21:33:51 +02:00
parent 6dcd9dac2e
commit 1d2abae9a1
8 changed files with 114 additions and 118 deletions

View File

@ -42,12 +42,10 @@ Options
Examples Examples
******** ********
1. Download a package and all of its dependencies #. Download a package and all of its dependencies
::
$ pip download SomePackage
$ pip download -d . SomePackage # equivalent to above
$ pip download --no-index --find-links=/tmp/wheelhouse -d /tmp/otherwheelhouse SomePackage
::
$ pip download SomePackage
$ pip download -d . SomePackage # equivalent to above
$ pip download --no-index --find-links=/tmp/wheelhouse -d /tmp/otherwheelhouse SomePackage

View File

@ -27,21 +27,21 @@ Options
Examples Examples
******** ********
1) Generate output suitable for a requirements file. #. Generate output suitable for a requirements file.
:: ::
$ pip freeze $ pip freeze
docutils==0.11 docutils==0.11
Jinja2==2.7.2 Jinja2==2.7.2
MarkupSafe==0.19 MarkupSafe==0.19
Pygments==1.6 Pygments==1.6
Sphinx==1.2.2 Sphinx==1.2.2
2) Generate a requirements file and then install from it in another environment. #. Generate a requirements file and then install from it in another environment.
:: ::
$ env1/bin/pip freeze > requirements.txt $ env1/bin/pip freeze > requirements.txt
$ env2/bin/pip install -r requirements.txt $ env2/bin/pip install -r requirements.txt

View File

@ -742,86 +742,86 @@ Options
Examples Examples
******** ********
1) Install `SomePackage` and its dependencies from `PyPI`_ using :ref:`Requirement Specifiers` #. Install `SomePackage` and its dependencies from `PyPI`_ using :ref:`Requirement Specifiers`
:: ::
$ pip install SomePackage # latest version $ pip install SomePackage # latest version
$ pip install SomePackage==1.0.4 # specific version $ pip install SomePackage==1.0.4 # specific version
$ pip install 'SomePackage>=1.0.4' # minimum version $ pip install 'SomePackage>=1.0.4' # minimum version
2) Install a list of requirements specified in a file. See the :ref:`Requirements files <Requirements Files>`. #. Install a list of requirements specified in a file. See the :ref:`Requirements files <Requirements Files>`.
:: ::
$ pip install -r requirements.txt $ pip install -r requirements.txt
3) Upgrade an already installed `SomePackage` to the latest from PyPI. #. Upgrade an already installed `SomePackage` to the latest from PyPI.
:: ::
$ pip install --upgrade SomePackage $ pip install --upgrade SomePackage
4) Install a local project in "editable" mode. See the section on :ref:`Editable Installs <editable-installs>`. #. Install a local project in "editable" mode. See the section on :ref:`Editable Installs <editable-installs>`.
:: ::
$ pip install -e . # project in current directory $ pip install -e . # project in current directory
$ pip install -e path/to/project # project in another directory $ pip install -e path/to/project # project in another directory
5) Install a project from VCS in "editable" mode. See the sections on :ref:`VCS Support <VCS Support>` and :ref:`Editable Installs <editable-installs>`. #. Install a project from VCS in "editable" mode. See the sections on :ref:`VCS Support <VCS Support>` and :ref:`Editable Installs <editable-installs>`.
:: ::
$ pip install -e git+https://git.repo/some_pkg.git#egg=SomePackage # from git $ pip install -e git+https://git.repo/some_pkg.git#egg=SomePackage # from git
$ pip install -e hg+https://hg.repo/some_pkg.git#egg=SomePackage # from mercurial $ pip install -e hg+https://hg.repo/some_pkg.git#egg=SomePackage # from mercurial
$ pip install -e svn+svn://svn.repo/some_pkg/trunk/#egg=SomePackage # from svn $ pip install -e svn+svn://svn.repo/some_pkg/trunk/#egg=SomePackage # from svn
$ pip install -e git+https://git.repo/some_pkg.git@feature#egg=SomePackage # from 'feature' branch $ pip install -e git+https://git.repo/some_pkg.git@feature#egg=SomePackage # from 'feature' branch
$ pip install -e "git+https://git.repo/some_repo.git#egg=subdir&subdirectory=subdir_path" # install a python package from a repo subdirectory $ pip install -e "git+https://git.repo/some_repo.git#egg=subdir&subdirectory=subdir_path" # install a python package from a repo subdirectory
6) Install a package with `setuptools extras`_. #. Install a package with `setuptools extras`_.
:: ::
$ pip install SomePackage[PDF] $ pip install SomePackage[PDF]
$ pip install SomePackage[PDF]==3.0 $ pip install SomePackage[PDF]==3.0
$ pip install -e .[PDF]==3.0 # editable project in current directory $ pip install -e .[PDF]==3.0 # editable project in current directory
7) Install a particular source archive file. #. Install a particular source archive file.
:: ::
$ pip install ./downloads/SomePackage-1.0.4.tar.gz $ pip install ./downloads/SomePackage-1.0.4.tar.gz
$ pip install http://my.package.repo/SomePackage-1.0.4.zip $ pip install http://my.package.repo/SomePackage-1.0.4.zip
8) Install from alternative package repositories. #. Install from alternative package repositories.
Install from a different index, and not `PyPI`_ :: Install from a different index, and not `PyPI`_ ::
$ pip install --index-url http://my.package.repo/simple/ SomePackage $ pip install --index-url http://my.package.repo/simple/ SomePackage
Search an additional index during install, in addition to `PyPI`_ :: Search an additional index during install, in addition to `PyPI`_ ::
$ pip install --extra-index-url http://my.package.repo/simple SomePackage $ pip install --extra-index-url http://my.package.repo/simple SomePackage
Install from a local flat directory containing archives (and don't scan indexes):: Install from a local flat directory containing archives (and don't scan indexes)::
$ pip install --no-index --find-links=file:///local/dir/ SomePackage $ pip install --no-index --find-links=file:///local/dir/ SomePackage
$ pip install --no-index --find-links=/local/dir/ SomePackage $ pip install --no-index --find-links=/local/dir/ SomePackage
$ pip install --no-index --find-links=relative/dir/ SomePackage $ pip install --no-index --find-links=relative/dir/ SomePackage
9) Find pre-release and development versions, in addition to stable versions. By default, pip only finds stable versions. #. Find pre-release and development versions, in addition to stable versions. By default, pip only finds stable versions.
:: ::
$ pip install --pre SomePackage $ pip install --pre SomePackage
---- ----

View File

@ -26,53 +26,53 @@ Options
Examples Examples
******** ********
1) List installed packages. #. List installed packages.
:: ::
$ pip list $ pip list
docutils (0.10) docutils (0.10)
Jinja2 (2.7.2) Jinja2 (2.7.2)
MarkupSafe (0.18) MarkupSafe (0.18)
Pygments (1.6) Pygments (1.6)
Sphinx (1.2.1) Sphinx (1.2.1)
2) List outdated packages (excluding editables), and the latest version available #. List outdated packages (excluding editables), and the latest version available.
:: ::
$ pip list --outdated $ pip list --outdated
docutils (Current: 0.10 Latest: 0.11) docutils (Current: 0.10 Latest: 0.11)
Sphinx (Current: 1.2.1 Latest: 1.2.2) Sphinx (Current: 1.2.1 Latest: 1.2.2)
3) List installed packages with column formatting. #. List installed packages with column formatting.
:: ::
$ pip list --columns $ pip list --columns
Package Version Package Version
------- ------- ------- -------
docopt 0.6.2 docopt 0.6.2
idlex 1.13 idlex 1.13
jedi 0.9.0 jedi 0.9.0
4) List outdated packages with column formatting. #. List outdated packages with column formatting.
:: ::
$ pip list -o --columns $ pip list -o --columns
Package Version Latest Type Package Version Latest Type
---------- ------- ------ ----- ---------- ------- ------ -----
retry 0.8.1 0.9.1 wheel retry 0.8.1 0.9.1 wheel
setuptools 20.6.7 21.0.0 wheel setuptools 20.6.7 21.0.0 wheel
5) Do not use column formatting. #. Do not use column formatting.
:: ::
$ pip list --no-columns $ pip list --no-columns
DEPRECATION: The --no-columns option will be removed in the future. DEPRECATION: The --no-columns option will be removed in the future.
colorama (0.3.7) colorama (0.3.7)
docopt (0.6.2) docopt (0.6.2)
idlex (1.13) idlex (1.13)
jedi (0.9.0) jedi (0.9.0)

View File

@ -25,10 +25,10 @@ Options
Examples Examples
******** ********
1. Search for "peppercorn" #. Search for "peppercorn"
:: ::
$ pip search peppercorn $ pip search peppercorn
pepperedform - Helpers for using peppercorn with formprocess. pepperedform - Helpers for using peppercorn with formprocess.
peppercorn - A library for converting a token stream into [...] peppercorn - A library for converting a token stream into [...]

View File

@ -25,13 +25,13 @@ Options
Examples Examples
******** ********
1. Show information about a package: #. Show information about a package:
:: ::
$ pip show sphinx $ pip show sphinx
--- ---
Name: Sphinx Name: Sphinx
Version: 1.1.3 Version: 1.1.3
Location: /my/env/lib/pythonx.x/site-packages Location: /my/env/lib/pythonx.x/site-packages
Requires: Pygments, Jinja2, docutils Requires: Pygments, Jinja2, docutils

View File

@ -24,7 +24,7 @@ Options
Examples Examples
******** ********
1) Uninstall a package. #. Uninstall a package.
:: ::

View File

@ -65,11 +65,9 @@ Options
Examples Examples
******** ********
1. Build wheels for a requirement (and all its dependencies), and then install #. Build wheels for a requirement (and all its dependencies), and then install
::
$ pip wheel --wheel-dir=/tmp/wheelhouse SomePackage
$ pip install --no-index --find-links=/tmp/wheelhouse SomePackage
::
$ pip wheel --wheel-dir=/tmp/wheelhouse SomePackage
$ pip install --no-index --find-links=/tmp/wheelhouse SomePackage