Skip to content

Commit 3f97bec

Browse files
Rebecca TurnerJon Wayne Parrott
authored andcommitted
Change filename to :file:filename throughout (pypa#458)
1 parent e695953 commit 3f97bec

11 files changed

+128
-121
lines changed

source/discussions/install-requires-vs-requirements.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ install_requires vs Requirements files
1111
install_requires
1212
----------------
1313

14-
``install_requires`` is a :ref:`setuptools` ``setup.py`` keyword that should be
15-
used to specify what a project **minimally** needs to run correctly. When the
16-
project is installed by :ref:`pip`, this is the specification that is used to
17-
install its dependencies.
14+
``install_requires`` is a :ref:`setuptools` :file:`setup.py` keyword that
15+
should be used to specify what a project **minimally** needs to run correctly.
16+
When the project is installed by :ref:`pip`, this is the specification that is
17+
used to install its dependencies.
1818

1919
For example, if the project requires A and B, your ``install_requires`` would be
2020
like so:

source/guides/creating-and-discovering-plugins.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ but it's not recommended to make your project's main top-level package (
105105
``myapp`` in this case) a namespace package for the purpose of plugins, as one
106106
bad plugin could cause the entire namespace to break which would in turn make
107107
your project unimportable. For the "namespace sub-package" approach to work,
108-
the plugin packages must omit the ``__init__.py`` for your top-level package
109-
directory (``myapp`` in this case) and include the namespace-package style
110-
``__init__.py`` in the namespace sub-package directory (``myapp/plugins``).
111-
This also means that plugins will need to explicitly pass a list of packages
112-
to :func:`setup`'s ``packages`` argument instead of using
108+
the plugin packages must omit the :file:`__init__.py` for your top-level
109+
package directory (``myapp`` in this case) and include the namespace-package
110+
style :file:`__init__.py` in the namespace sub-package directory
111+
(``myapp/plugins``). This also means that plugins will need to explicitly pass
112+
a list of packages to :func:`setup`'s ``packages`` argument instead of using
113113
:func:`setuptools.find_packages`.
114114

115115
.. warning:: Namespace packages are a complex feature and there are several
@@ -121,11 +121,11 @@ Using package metadata
121121
======================
122122

123123
`Setuptools`_ provides `special support`_ for plugins. By
124-
providing the ``entry_points`` argument to :func:`setup` in ``setup.py``
124+
providing the ``entry_points`` argument to :func:`setup` in :file:`setup.py`
125125
plugins can register themselves for discovery.
126126

127127
For example if you have a package named ``myapp-plugin-a`` and it includes
128-
in its ``setup.py``:
128+
in its :file:`setup.py`:
129129

130130
.. code-block:: python
131131
@@ -156,9 +156,9 @@ In this example, ``plugins`` would be :
156156
'a': <module: 'myapp_plugin_a'>,
157157
}
158158
159-
.. note:: The ``entry_point`` specification in ``setup.py`` is fairly flexible
160-
and has a lot of options. It's recommended to read over the entire section
161-
on `entry points`_.
159+
.. note:: The ``entry_point`` specification in :file:`setup.py` is fairly
160+
flexible and has a lot of options. It's recommended to read over the entire
161+
section on `entry points`_.
162162

163163
.. _Setuptools: http://setuptools.readthedocs.io
164164
.. _special support:

source/guides/installing-using-pip-and-virtualenv.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ Using requirements files
337337

338338
Instead of installing packages individually, pip allows you to declare all
339339
dependencies in a :ref:`Requirements File <pip:Requirements Files>`. For
340-
example you could create a ``requirements.txt`` file containing:
340+
example you could create a :file:`requirements.txt` file containing:
341341

342342
.. code-block:: text
343343

source/guides/packaging-namespace-packages.rst

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Native namespace packages
8181

8282
Python 3.3 added **implicit** namespace packages from :pep:`420`. All that is
8383
required to create a native namespace package is that you just omit
84-
``__init__.py`` from the namespace package directory. An example file
84+
:file:`__init__.py` from the namespace package directory. An example file
8585
structure:
8686

8787
.. code-block:: text
@@ -95,13 +95,13 @@ structure:
9595
module.py
9696
9797
It is extremely important that every distribution that uses the namespace
98-
package omits the ``__init__.py`` or uses a pkgutil-style ``__init__.py``. If
99-
any distribution does not, it will cause the namespace logic to fail and the
100-
other sub-packages will not be importable.
98+
package omits the :file:`__init__.py` or uses a pkgutil-style
99+
:file:`__init__.py`. If any distribution does not, it will cause the namespace
100+
logic to fail and the other sub-packages will not be importable.
101101

102-
Because ``mynamespace`` doesn't contain an ``__init__.py``,
102+
Because ``mynamespace`` doesn't contain an :file:`__init__.py`,
103103
:func:`setuptools.find_packages` won't find the sub-package. You must
104-
explicitly list all packages in your ``setup.py``. For example:
104+
explicitly list all packages in your :file:`setup.py`. For example:
105105

106106
.. code-block:: python
107107
@@ -133,7 +133,7 @@ packages that need to be compatible with both Python 2.3+ and Python 3. This
133133
is the recommended approach for the highest level of compatibility.
134134

135135
To create a pkgutil-style namespace package, you need to provide an
136-
``__init__.py`` file for the namespace package:
136+
:file:`__init__.py` file for the namespace package:
137137

138138
.. code-block:: text
139139
@@ -144,17 +144,17 @@ To create a pkgutil-style namespace package, you need to provide an
144144
__init__.py # Sub-package __init__.py
145145
module.py
146146
147-
The ``__init__.py`` file for the namespace package needs to contain **only**
148-
the following:
147+
The :file:`__init__.py` file for the namespace package needs to contain
148+
**only** the following:
149149

150150
.. code-block:: python
151151
152152
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
153153
154154
**Every** distribution that uses the namespace package must include an
155-
identical ``__init__.py``. If any distribution does not, it will cause the
156-
namespace logic to fail and the other sub-packages will not be importable. Any
157-
additional code in ``__init__.py`` will be inaccessible.
155+
identical :file:`__init__.py`. If any distribution does not, it will cause the
156+
namespace logic to fail and the other sub-packages will not be importable. Any
157+
additional code in :file:`__init__.py` will be inaccessible.
158158

159159
A complete working example of two pkgutil-style namespace packages can be found
160160
in the `pkgutil namespace example project`_.
@@ -179,7 +179,7 @@ methods are not cross-compatible and it's not advisable to try to migrate an
179179
existing package.
180180

181181
To create a pkg_resources-style namespace package, you need to provide an
182-
``__init__.py`` file for the namespace package:
182+
:file:`__init__.py` file for the namespace package:
183183

184184
.. code-block:: text
185185
@@ -190,20 +190,20 @@ To create a pkg_resources-style namespace package, you need to provide an
190190
__init__.py # Sub-package __init__.py
191191
module.py
192192
193-
The ``__init__.py`` file for the namespace package needs to contain **only**
194-
the following:
193+
The :file:`__init__.py` file for the namespace package needs to contain
194+
**only** the following:
195195

196196
.. code-block:: python
197197
198198
__import__('pkg_resources').declare_namespace(__name__)
199199
200200
**Every** distribution that uses the namespace package must include an
201-
identical ``__init__.py``. If any distribution does not, it will cause the
202-
namespace logic to fail and the other sub-packages will not be importable. Any
203-
additional code in ``__init__.py`` will be inaccessible.
201+
identical :file:`__init__.py`. If any distribution does not, it will cause the
202+
namespace logic to fail and the other sub-packages will not be importable. Any
203+
additional code in :file:`__init__.py` will be inaccessible.
204204

205205
.. note:: Some older recommendations advise the following in the namespace
206-
package ``__init__.py``:
206+
package :file:`__init__.py`:
207207

208208
.. code-block:: python
209209
@@ -220,7 +220,7 @@ additional code in ``__init__.py`` will be inaccessible.
220220
``install_requires``.
221221

222222
Finally, every distribution must provide the ``namespace_packages`` argument
223-
to :func:`~setuptools.setup` in ``setup.py``. For example:
223+
to :func:`~setuptools.setup` in :file:`setup.py`. For example:
224224

225225
.. code-block:: python
226226

source/guides/single-sourcing-package-version.rst

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ Single-sourcing the package version
88
There are many techniques to maintain a single source of truth for the version
99
number of your project:
1010

11-
#. Read the file in ``setup.py`` and parse the version with a regex. Example (
12-
from `pip setup.py <https://github.com/pypa/pip/blob/master/setup.py#L12>`_)::
13-
11+
#. Read the file in :file:`setup.py` and parse the version with a regex.
12+
Example ( from `pip setup.py
13+
<https://github.com/pypa/pip/blob/master/setup.py#L12>`_)::
14+
1415
here = os.path.abspath(os.path.dirname(__file__))
1516

1617
def read(*parts):
@@ -44,8 +45,8 @@ number of your project:
4445

4546

4647
#. Set the value to a ``__version__`` global variable in a dedicated module in
47-
your project (e.g. ``version.py``), then have ``setup.py`` read and ``exec`` the
48-
value into a variable.
48+
your project (e.g. :file:`version.py`), then have :file:`setup.py` read and
49+
``exec`` the value into a variable.
4950

5051
Using ``execfile``:
5152

@@ -66,8 +67,8 @@ number of your project:
6667

6768
Example using this technique: `warehouse <https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py>`_.
6869

69-
#. Place the value in a simple ``VERSION`` text file and have both ``setup.py``
70-
and the project code read it.
70+
#. Place the value in a simple ``VERSION`` text file and have both
71+
:file:`setup.py` and the project code read it.
7172

7273
::
7374

@@ -81,9 +82,9 @@ number of your project:
8182

8283
With this approach you must make sure that the ``VERSION`` file is included in
8384
all your source and binary distributions (e.g. add ``include VERSION`` to your
84-
``MANIFEST.in``).
85+
:file:`MANIFEST.in`).
8586

86-
#. Set the value in ``setup.py``, and have the project code use the
87+
#. Set the value in :file:`setup.py`, and have the project code use the
8788
``pkg_resources`` API.
8889

8990
::
@@ -97,7 +98,7 @@ number of your project:
9798

9899

99100
#. Set the value to ``__version__`` in ``sample/__init__.py`` and import
100-
``sample`` in ``setup.py``.
101+
``sample`` in :file:`setup.py`.
101102

102103
::
103104

@@ -110,8 +111,8 @@ number of your project:
110111

111112
Although this technique is common, beware that it will fail if
112113
``sample/__init__.py`` imports packages from ``install_requires``
113-
dependencies, which will very likely not be installed yet when ``setup.py``
114-
is run.
114+
dependencies, which will very likely not be installed yet when
115+
:file:`setup.py` is run.
115116

116117

117118
#. Keep the version number in the tags of a version control system (Git, Mercurial, etc)

source/guides/supporting-windows-using-appveyor.rst

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ Adding Appveyor support to your project
5454
=======================================
5555

5656
In order to define how Appveyor should build your project, you need to add an
57-
``appveyor.yml`` file to your project. The full details of what can be included
58-
in the file are covered in the Appveyor documentation. This guide will provide
59-
the details necessary to set up wheel builds.
57+
:file:`appveyor.yml` file to your project. The full details of what can be
58+
included in the file are covered in the Appveyor documentation. This guide will
59+
provide the details necessary to set up wheel builds.
6060

6161
Appveyor includes by default all of the compiler toolchains needed to build
6262
extensions for Python. For Python 2.7, 3.5+ and 32-bit versions of 3.3 and 3.4,
@@ -74,7 +74,7 @@ appveyor.yml
7474

7575
This file can be downloaded from `here <https://raw.githubusercontent.com/pypa/python-packaging-user-guide/master/source/guides/appveyor-sample/appveyor.yml>`__.
7676

77-
The ``appveyor.yml`` file must be located in the root directory of your
77+
The :file:`appveyor.yml` file must be located in the root directory of your
7878
project. It is in ``YAML`` format, and consists of a number of sections.
7979

8080
The ``environment`` section is the key to defining the Python versions for
@@ -101,10 +101,10 @@ The ``test_script`` section is where you will run your project's tests. The
101101
supplied file runs your test suite using ``setup.py test``. If you are only
102102
interested in building wheels, and not in running your tests on Windows, you
103103
can replace this section with a dummy command such as ``echo Skipped Tests``.
104-
You may wish to use another test tool, such as ``nose`` or ``py.test``. Or you
105-
may wish to use a test driver like ``tox`` - however if you are using ``tox``
106-
there are some additional configuration changes you will need to consider,
107-
which are described below.
104+
You may wish to use another test tool, such as ``nose`` or :file:`py.test`. Or
105+
you may wish to use a test driver like ``tox`` - however if you are using
106+
``tox`` there are some additional configuration changes you will need to
107+
consider, which are described below.
108108

109109
The ``after_test`` runs once your tests have completed, and so is where the
110110
wheels should be built. Assuming your project uses the recommended tools
@@ -118,10 +118,10 @@ tests to fail on Windows, you can skip them as described above.
118118
Support script
119119
--------------
120120

121-
The ``appveyor.yml`` file relies on a single support script, which sets up the
122-
environment to use the SDK compiler for 64-bit builds on Python 3.3 and 3.4.
123-
For projects which do not need a compiler, or which don't support 3.3 or 3.4 on
124-
64-bit Windows, only the ``appveyor.yml`` file is needed.
121+
The :file:`appveyor.yml` file relies on a single support script, which sets up
122+
the environment to use the SDK compiler for 64-bit builds on Python 3.3 and
123+
3.4. For projects which do not need a compiler, or which don't support 3.3 or
124+
3.4 on 64-bit Windows, only the :file:`appveyor.yml` file is needed.
125125

126126
`build.cmd <https://raw.githubusercontent.com/pypa/python-packaging-user-guide/master/source/guides/appveyor-sample/build.cmd>`__
127127
is a Windows batch script that runs a single command in an environment with the
@@ -172,10 +172,11 @@ other CI systems).
172172
- ``INCLUDE``
173173
- ``LIB``
174174

175-
The ``passenv`` option can be set in your ``tox.ini``, or if you prefer to avoid
176-
adding Windows-specific settings to your general project files, it can be set by
177-
setting the ``TOX_TESTENV_PASSENV`` environment variable. The supplied ``build.cmd``
178-
script does this by default whenever ``DISTUTILS_USE_SDK`` is set.
175+
The ``passenv`` option can be set in your :file:`tox.ini`, or if you prefer
176+
to avoid adding Windows-specific settings to your general project files, it
177+
can be set by setting the ``TOX_TESTENV_PASSENV`` environment variable. The
178+
supplied :file:`build.cmd` script does this by default whenever
179+
``DISTUTILS_USE_SDK`` is set.
179180

180181
2. When used interactively, ``tox`` allows you to run your tests against multiple
181182
environments (often, this means multiple Python versions). This feature is not as
@@ -194,33 +195,35 @@ other CI systems).
194195
will be run with the configured interpreter.
195196

196197
In order to support running under the ``py`` environment, it is possible that
197-
projects with complex ``tox`` configurations might need to modify their ``tox.ini``
198-
file. Doing so is, however, outside the scope of this document.
198+
projects with complex ``tox`` configurations might need to modify their
199+
:file:`tox.ini` file. Doing so is, however, outside the scope of this
200+
document.
199201

200202
Automatically uploading wheels
201203
------------------------------
202204

203205
It is possible to request Appveyor to automatically upload wheels. There is a
204-
``deployment`` step available in ``appveyor.yml`` that can be used to (for
206+
``deployment`` step available in :file:`appveyor.yml` that can be used to (for
205207
example) copy the built artifacts to a FTP site, or an Amazon S3 instance.
206208
Documentation on how to do this is included in the Appveyor guides.
207209

208210
Alternatively, it would be possible to add a ``twine upload`` step to the
209-
build. The supplied ``appveyor.yml`` does not do this, as it is not clear that
210-
uploading new wheels after every commit is desirable (although some projects
211-
may wish to do this).
211+
build. The supplied :file:`appveyor.yml` does not do this, as it is not clear
212+
that uploading new wheels after every commit is desirable (although some
213+
projects may wish to do this).
212214

213215
External dependencies
214216
---------------------
215217

216218
The supplied scripts will successfully build any distribution that does not
217219
rely on 3rd party external libraries for the build.
218220

219-
It is possible to add steps to the ``appveyor.yml`` configuration (typically
220-
in the "install" section) to download and/or build external libraries needed by
221-
the distribution. And if needed, it is possible to add extra configuration for
222-
the build to supply the location of these libraries to the compiler. However,
223-
this level of configuration is beyond the scope of this document.
221+
It is possible to add steps to the :file:`appveyor.yml` configuration
222+
(typically in the "install" section) to download and/or build external
223+
libraries needed by the distribution. And if needed, it is possible to add
224+
extra configuration for the build to supply the location of these libraries to
225+
the compiler. However, this level of configuration is beyond the scope of this
226+
document.
224227

225228

226229
Support scripts

source/key_projects.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ Pipfile
100100

101101
`Source <https://github.com/pypa/pipfile>`__
102102

103-
``Pipfile`` and its sister ``Pipfile.lock`` are a higher-level
103+
:file:`Pipfile` and its sister :file:`Pipfile.lock` are a higher-level
104104
application-centric alternative to :ref:`pip`'s lower-level
105-
``requirements.txt`` file.
105+
:file:`requirements.txt` file.
106106

107107

108108
Python Packaging User Guide
@@ -332,11 +332,11 @@ pex
332332
`Github <https://github.com/pantsbuild/pex/>`__ |
333333
`PyPI <https://pypi.python.org/pypi/pex>`__
334334

335-
pex is both a library and tool for generating ``.pex`` (Python EXecutable)
335+
pex is both a library and tool for generating :file:`.pex` (Python EXecutable)
336336
files, standalone Python environments in the spirit of :ref:`virtualenv`.
337-
``.pex`` files are just carefully constructed zip files with a
338-
``#!/usr/bin/env python`` and special ``__main__.py``, and are designed to make
339-
deployment of Python applications as simple as ``cp``.
337+
:file:`.pex` files are just carefully constructed zip files with a
338+
``#!/usr/bin/env python`` and special :file:`__main__.py`, and are designed to
339+
make deployment of Python applications as simple as ``cp``.
340340

341341

342342
.. _spack:

0 commit comments

Comments
 (0)