Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
1e5fa9b3
Commit
1e5fa9b3
authored
Jan 15, 2020
by
Géry Ogam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Uniformise quotation marks
parent
2ce065e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
52 deletions
+52
-52
docs/setuptools.txt
docs/setuptools.txt
+52
-52
No files found.
docs/setuptools.txt
View file @
1e5fa9b3
...
...
@@ -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
...
...
@@ -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.
...
...
@@ -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
...
...
@@ -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.
...
...
@@ -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
...
...
@@ -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
...
...
@@ -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/
...
...
@@ -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"
,
]
}
)
...
...
@@ -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"
,
]
}
)
...
...
@@ -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"],
}
)
...
...
@@ -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 ...
],
}
...
...
@@ -801,8 +801,8 @@ setup to this::
name="Project-A",
...
extras_require={
'PDF'
: [],
'reST'
: ["docutils>=0.3"],
"PDF"
: [],
"reST"
: ["docutils>=0.3"],
}
)
...
...
@@ -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'"
]
)
...
...
@@ -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"
],
}
)
...
...
@@ -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"
],
}
)
...
...
@@ -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
...
...
@@ -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``.
...
...
@@ -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(
...
...
@@ -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``
...
...
@@ -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.
...
...
@@ -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.
...
...
@@ -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
...
...
@@ -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
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment