Skip to content

Commit

Permalink
Uniformise quotation marks
Browse files Browse the repository at this point in the history
  • Loading branch information
geryogam committed Jan 15, 2020
1 parent 2ce065e commit 1e5fa9b
Showing 1 changed file with 52 additions and 52 deletions.
104 changes: 52 additions & 52 deletions docs/setuptools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,17 @@ dependencies, and perhaps some data files and scripts::
name="HelloWorld",
version="0.1",
packages=find_packages(),
scripts=['say_hello.py'],
scripts=["say_hello.py"],

# Project uses reStructuredText, so ensure that the docutils get
# installed or upgraded on the target machine
install_requires=['docutils>=0.3'],
install_requires=["docutils>=0.3"],

package_data={
# If any package contains *.txt or *.rst files, include them:
'': ['*.txt', '*.rst'],
# And include any *.msg files found in the 'hello' package, too:
'hello': ['*.msg'],
"": ["*.txt", "*.rst"],
# And include any *.msg files found in the "hello" package, too:
"hello": ["*.msg"],
},

# metadata to display on PyPI
Expand All @@ -125,7 +125,7 @@ dependencies, and perhaps some data files and scripts::
"Source Code": "https://code.example.com/HelloWorld/",
},
classifiers=[
'License :: OSI Approved :: Python Software Foundation License'
"License :: OSI Approved :: Python Software Foundation License"
]

# could also include long_description, download_url, etc.
Expand Down Expand Up @@ -207,11 +207,11 @@ but here are a few tips that will keep you out of trouble in the corner cases:
to compare different version numbers::

>>> from pkg_resources import parse_version
>>> parse_version('1.9.a.dev') == parse_version('1.9a0dev')
>>> parse_version("1.9.a.dev") == parse_version("1.9a0dev")
True
>>> parse_version('2.1-rc2') < parse_version('2.1')
>>> parse_version("2.1-rc2") < parse_version("2.1")
True
>>> parse_version('0.6a9dev-r41475') < parse_version('0.6a9')
>>> parse_version("0.6a9dev-r41475") < parse_version("0.6a9")
True

Once you've decided on a version numbering scheme for your project, you can
Expand Down Expand Up @@ -371,7 +371,7 @@ unless you need the associated ``setuptools`` feature.
imported. This argument is only useful if the project will be installed as
a zipfile, and there is a need to have all of the listed resources be
extracted to the filesystem *as a unit*. Resources listed here
should be '/'-separated paths, relative to the source root, so to list a
should be "/"-separated paths, relative to the source root, so to list a
resource ``foo.png`` in package ``bar.baz``, you would include the string
``bar/baz/foo.png`` in this argument.

Expand Down Expand Up @@ -413,7 +413,7 @@ the same
directory as the setup script. Some projects use a ``src`` or ``lib``
directory as the root of their source tree, and those projects would of course
use ``"src"`` or ``"lib"`` as the first argument to ``find_packages()``. (And
such projects also need something like ``package_dir={'':'src'}`` in their
such projects also need something like ``package_dir={"": "src"}`` in their
``setup()`` arguments, but that's just a normal distutils thing.)

Anyway, ``find_packages()`` walks the target directory, filtering by inclusion
Expand Down Expand Up @@ -480,7 +480,7 @@ top-level package called ``tests``! One way to avoid this problem is to use the
setup(
name="namespace.mypackage",
version="0.1",
packages=find_namespace_packages(include=['namespace.*'])
packages=find_namespace_packages(include=["namespace.*"])
)

Another option is to use the "src" layout, where all package code is placed in
Expand All @@ -500,8 +500,8 @@ With this layout, the package directory is specified as ``src``, as such::

setup(name="namespace.mypackage",
version="0.1",
package_dir={'': 'src'},
packages=find_namespace_packages(where='src'))
package_dir={"": "src"},
packages=find_namespace_packages(where="src"))

.. _PEP 420: https://www.python.org/dev/peps/pep-0420/

Expand All @@ -526,12 +526,12 @@ script called ``baz``, you might do something like this::
setup(
# other arguments here...
entry_points={
'console_scripts': [
'foo = my_package.some_module:main_func',
'bar = other_module:some_func',
"console_scripts": [
"foo = my_package.some_module:main_func",
"bar = other_module:some_func",
],
'gui_scripts': [
'baz = my_package_gui:start_func',
"gui_scripts": [
"baz = my_package_gui:start_func",
]
}
)
Expand Down Expand Up @@ -567,8 +567,8 @@ as the following::
setup(
# other arguments here...
entry_points={
'setuptools.installation': [
'eggsecutable = my_package.some_module:main_func',
"setuptools.installation": [
"eggsecutable = my_package.some_module:main_func",
]
}
)
Expand Down Expand Up @@ -741,8 +741,8 @@ For example, let's say that Project A offers optional PDF and reST support::
name="Project-A",
...
extras_require={
'PDF': ["ReportLab>=1.2", "RXP"],
'reST': ["docutils>=0.3"],
"PDF": ["ReportLab>=1.2", "RXP"],
"reST": ["docutils>=0.3"],
}
)

Expand All @@ -763,9 +763,9 @@ declare it like this, so that the "PDF" requirements are only resolved if the
name="Project-A",
...
entry_points={
'console_scripts': [
'rst2pdf = project_a.tools.pdfgen [PDF]',
'rst2html = project_a.tools.htmlgen',
"console_scripts": [
"rst2pdf = project_a.tools.pdfgen [PDF]",
"rst2html = project_a.tools.htmlgen",
# more script entry points ...
],
}
Expand Down Expand Up @@ -801,8 +801,8 @@ setup to this::
name="Project-A",
...
extras_require={
'PDF': [],
'reST': ["docutils>=0.3"],
"PDF": [],
"reST": ["docutils>=0.3"],
}
)

Expand All @@ -829,8 +829,8 @@ For example, here is a project that uses the ``enum`` module and ``pywin32``::
name="Project",
...
install_requires=[
'enum34;python_version<"3.4"',
'pywin32 >= 1.0;platform_system=="Windows"'
"enum34;python_version<'3.4'",
"pywin32 >= 1.0;platform_system=='Windows'"
]
)

Expand Down Expand Up @@ -878,9 +878,9 @@ e.g.::
...
package_data={
# If any package contains *.txt or *.rst files, include them:
'': ['*.txt', '*.rst'],
# And include any *.msg files found in the 'hello' package, too:
'hello': ['*.msg'],
"": ["*.txt", "*.rst"],
# And include any *.msg files found in the "hello" package, too:
"hello": ["*.msg"],
}
)

Expand All @@ -903,15 +903,15 @@ The setuptools setup file might look like this::
from setuptools import setup, find_packages
setup(
...
packages=find_packages('src'), # include all packages under src
package_dir={'':'src'}, # tell distutils packages are under src
packages=find_packages("src"), # include all packages under src
package_dir={"": "src"}, # tell distutils packages are under src

package_data={
# If any package contains *.txt files, include them:
'': ['*.txt'],
# And include any *.dat files found in the 'data' subdirectory
# of the 'mypkg' package, also:
'mypkg': ['data/*.dat'],
"": ["*.txt"],
# And include any *.dat files found in the "data" subdirectory
# of the "mypkg" package, also:
"mypkg": ["data/*.dat"],
}
)

Expand All @@ -926,7 +926,7 @@ converts slashes to appropriate platform-specific separators at build time.

If datafiles are contained in a subdirectory of a package that isn't a package
itself (no ``__init__.py``), then the subdirectory names (or ``*``) are required
in the ``package_data`` argument (as shown above with ``'data/*.dat'``).
in the ``package_data`` argument (as shown above with ``"data/*.dat"``).

When building an ``sdist``, the datafiles are also drawn from the
``package_name.egg-info/SOURCES.txt`` file, so make sure that this is removed if
Expand All @@ -951,18 +951,18 @@ to do things like this::
from setuptools import setup, find_packages
setup(
...
packages=find_packages('src'), # include all packages under src
package_dir={'':'src'}, # tell distutils packages are under src
packages=find_packages("src"), # include all packages under src
package_dir={"": "src"}, # tell distutils packages are under src

include_package_data=True, # include everything in source control

# ...but exclude README.txt from all packages
exclude_package_data={'': ['README.txt']},
exclude_package_data={"": ["README.txt"]},
)

The ``exclude_package_data`` option is a dictionary mapping package names to
lists of wildcard patterns, just like the ``package_data`` option. And, just
as with that option, a key of ``''`` will apply the given pattern(s) to all
as with that option, a key of ``""`` will apply the given pattern(s) to all
packages. However, any files that match these patterns will be *excluded*
from installation, even if they were listed in ``package_data`` or were
included as a result of using ``include_package_data``.
Expand Down Expand Up @@ -1096,12 +1096,12 @@ for our hypothetical blogging tool::

setup(
# ...
entry_points={'blogtool.parsers': '.rst = some_module:SomeClass'}
entry_points={"blogtool.parsers": ".rst = some_module:SomeClass"}
)

setup(
# ...
entry_points={'blogtool.parsers': ['.rst = some_module:a_func']}
entry_points={"blogtool.parsers": [".rst = some_module:a_func"]}
)

setup(
Expand Down Expand Up @@ -1309,7 +1309,7 @@ participates in. For example, the ZopeInterface project might do this::

setup(
# ...
namespace_packages=['zope']
namespace_packages=["zope"]
)

because it contains a ``zope.interface`` package that lives in the ``zope``
Expand All @@ -1327,7 +1327,7 @@ packages' ``__init__.py`` files (and the ``__init__.py`` of any parent
packages), in a normal Python package layout. These ``__init__.py`` files
*must* contain the line::

__import__('pkg_resources').declare_namespace(__name__)
__import__("pkg_resources").declare_namespace(__name__)

This code ensures that the namespace package machinery is operating and that
the current package is registered as a namespace package.
Expand Down Expand Up @@ -1410,7 +1410,7 @@ pattern. So, you can use a command line like::

setup.py egg_info -rbDEV bdist_egg rotate -m.egg -k3

to build an egg whose version info includes 'DEV-rNNNN' (where NNNN is the
to build an egg whose version info includes "DEV-rNNNN" (where NNNN is the
most recent Subversion revision that affected the source tree), and then
delete any egg files from the distribution directory except for the three
that were built most recently.
Expand Down Expand Up @@ -1500,7 +1500,7 @@ To ensure Cython is available, include Cython in the build-requires section
of your pyproject.toml::

[build-system]
requires=[..., 'cython']
requires=[..., "cython"]

Built with pip 10 or later, that declaration is sufficient to include Cython
in the build. For broader compatibility, declare the dependency in your
Expand Down Expand Up @@ -2351,7 +2351,7 @@ parsing ``metadata`` and ``options`` sections into a dictionary.

from setuptools.config import read_configuration

conf_dict = read_configuration('/home/user/dev/package/setup.cfg')
conf_dict = read_configuration("/home/user/dev/package/setup.cfg")


By default, ``read_configuration()`` will read only the file provided
Expand Down Expand Up @@ -2531,7 +2531,7 @@ a file. Here's what the writer utility looks like::
argname = os.path.splitext(basename)[0]
value = getattr(cmd.distribution, argname, None)
if value is not None:
value = '\n'.join(value) + '\n'
value = "\n".join(value) + "\n"
cmd.write_or_delete_file(argname, filename, value)

As you can see, ``egg_info.writers`` entry points must be a function taking
Expand Down

0 comments on commit 1e5fa9b

Please sign in to comment.