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
b2205e84
Commit
b2205e84
authored
Oct 14, 2016
by
Jason R. Coombs
Committed by
GitHub
Oct 14, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #813 from bittner/patch-1
Follow PEP8 for keyword arguments syntax in setup
parents
4ec92ae3
9485bee1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
45 deletions
+44
-45
docs/setuptools.txt
docs/setuptools.txt
+44
-45
No files found.
docs/setuptools.txt
View file @
b2205e84
...
@@ -106,9 +106,9 @@ the distutils. Here's a minimal setup script using setuptools::
...
@@ -106,9 +106,9 @@ the distutils. Here's a minimal setup script using setuptools::
from setuptools import setup, find_packages
from setuptools import setup, find_packages
setup(
setup(
name
=
"HelloWorld",
name
=
"HelloWorld",
version
=
"0.1",
version
=
"0.1",
packages
=
find_packages(),
packages
=
find_packages(),
)
)
As you can see, it doesn't take much to use setuptools in a project.
As you can see, it doesn't take much to use setuptools in a project.
...
@@ -130,16 +130,16 @@ dependencies, and perhaps some data files and scripts::
...
@@ -130,16 +130,16 @@ dependencies, and perhaps some data files and scripts::
from setuptools import setup, find_packages
from setuptools import setup, find_packages
setup(
setup(
name
=
"HelloWorld",
name
=
"HelloWorld",
version
=
"0.1",
version
=
"0.1",
packages
=
find_packages(),
packages
=
find_packages(),
scripts
=
['say_hello.py'],
scripts
=
['say_hello.py'],
# Project uses reStructuredText, so ensure that the docutils get
# Project uses reStructuredText, so ensure that the docutils get
# installed or upgraded on the target machine
# installed or upgraded on the target machine
install_requires
=
['docutils>=0.3'],
install_requires
=
['docutils>=0.3'],
package_data
=
{
package_data
=
{
# If any package contains *.txt or *.rst files, include them:
# If any package contains *.txt or *.rst files, include them:
'': ['*.txt', '*.rst'],
'': ['*.txt', '*.rst'],
# And include any *.msg files found in the 'hello' package, too:
# And include any *.msg files found in the 'hello' package, too:
...
@@ -147,12 +147,12 @@ dependencies, and perhaps some data files and scripts::
...
@@ -147,12 +147,12 @@ dependencies, and perhaps some data files and scripts::
},
},
# metadata for upload to PyPI
# metadata for upload to PyPI
author
=
"Me",
author
=
"Me",
author_email
=
"me@example.com",
author_email
=
"me@example.com",
description
=
"This is an Example Package",
description
=
"This is an Example Package",
license
=
"PSF",
license
=
"PSF",
keywords
=
"hello world example examples",
keywords
=
"hello world example examples",
url
=
"http://example.com/HelloWorld/", # project home page, if any
url
=
"http://example.com/HelloWorld/", # project home page, if any
# could also include long_description, download_url, classifiers, etc.
# could also include long_description, download_url, classifiers, etc.
)
)
...
@@ -431,7 +431,7 @@ the same
...
@@ -431,7 +431,7 @@ the same
directory as the setup script. Some projects use a ``src`` or ``lib``
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
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
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.)
``setup()`` arguments, but that's just a normal distutils thing.)
Anyway, ``find_packages()`` walks the target directory, filtering by inclusion
Anyway, ``find_packages()`` walks the target directory, filtering by inclusion
...
@@ -522,7 +522,7 @@ as the following::
...
@@ -522,7 +522,7 @@ as the following::
setup(
setup(
# other arguments here...
# other arguments here...
entry_points
=
{
entry_points
=
{
'setuptools.installation': [
'setuptools.installation': [
'eggsecutable = my_package.some_module:main_func',
'eggsecutable = my_package.some_module:main_func',
]
]
...
@@ -674,7 +674,7 @@ installed::
...
@@ -674,7 +674,7 @@ installed::
setup(
setup(
...
...
dependency_links
=
[
dependency_links
=
[
"http://peak.telecommunity.com/snapshots/"
"http://peak.telecommunity.com/snapshots/"
],
],
)
)
...
@@ -699,7 +699,7 @@ For example, let's say that Project A offers optional PDF and reST support::
...
@@ -699,7 +699,7 @@ For example, let's say that Project A offers optional PDF and reST support::
setup(
setup(
name="Project-A",
name="Project-A",
...
...
extras_require
=
{
extras_require
=
{
'PDF': ["ReportLab>=1.2", "RXP"],
'PDF': ["ReportLab>=1.2", "RXP"],
'reST': ["docutils>=0.3"],
'reST': ["docutils>=0.3"],
}
}
...
@@ -721,7 +721,7 @@ declare it like this, so that the "PDF" requirements are only resolved if the
...
@@ -721,7 +721,7 @@ declare it like this, so that the "PDF" requirements are only resolved if the
setup(
setup(
name="Project-A",
name="Project-A",
...
...
entry_points
=
{
entry_points
=
{
'console_scripts': [
'console_scripts': [
'rst2pdf = project_a.tools.pdfgen [PDF]',
'rst2pdf = project_a.tools.pdfgen [PDF]',
'rst2html = project_a.tools.htmlgen',
'rst2html = project_a.tools.htmlgen',
...
@@ -736,7 +736,7 @@ might declare the dependency like this::
...
@@ -736,7 +736,7 @@ might declare the dependency like this::
setup(
setup(
name="Project-B",
name="Project-B",
install_requires
=
["Project-A[PDF]"],
install_requires
=
["Project-A[PDF]"],
...
...
)
)
...
@@ -759,7 +759,7 @@ setup to this::
...
@@ -759,7 +759,7 @@ setup to this::
setup(
setup(
name="Project-A",
name="Project-A",
...
...
extras_require
=
{
extras_require
=
{
'PDF': [],
'PDF': [],
'reST': ["docutils>=0.3"],
'reST': ["docutils>=0.3"],
}
}
...
@@ -784,7 +784,7 @@ e.g.::
...
@@ -784,7 +784,7 @@ e.g.::
from setuptools import setup, find_packages
from setuptools import setup, find_packages
setup(
setup(
...
...
include_package_data
=
True
include_package_data
=
True
)
)
This tells setuptools to install any data files it finds in your packages.
This tells setuptools to install any data files it finds in your packages.
...
@@ -801,7 +801,7 @@ e.g.::
...
@@ -801,7 +801,7 @@ e.g.::
from setuptools import setup, find_packages
from setuptools import setup, find_packages
setup(
setup(
...
...
package_data
=
{
package_data
=
{
# If any package contains *.txt or *.rst files, include them:
# If any package contains *.txt or *.rst files, include them:
'': ['*.txt', '*.rst'],
'': ['*.txt', '*.rst'],
# And include any *.msg files found in the 'hello' package, too:
# And include any *.msg files found in the 'hello' package, too:
...
@@ -828,10 +828,10 @@ The setuptools setup file might look like this::
...
@@ -828,10 +828,10 @@ The setuptools setup file might look like this::
from setuptools import setup, find_packages
from setuptools import setup, find_packages
setup(
setup(
...
...
packages
=
find_packages('src'), # include all packages under src
packages
=
find_packages('src'), # include all packages under src
package_dir
=
{'':'src'}, # tell distutils packages are under src
package_dir
=
{'':'src'}, # tell distutils packages are under src
package_data
=
{
package_data
=
{
# If any package contains *.txt files, include them:
# If any package contains *.txt files, include them:
'': ['*.txt'],
'': ['*.txt'],
# And include any *.dat files found in the 'data' subdirectory
# And include any *.dat files found in the 'data' subdirectory
...
@@ -868,13 +868,13 @@ to do things like this::
...
@@ -868,13 +868,13 @@ to do things like this::
from setuptools import setup, find_packages
from setuptools import setup, find_packages
setup(
setup(
...
...
packages
=
find_packages('src'), # include all packages under src
packages
=
find_packages('src'), # include all packages under src
package_dir
=
{'':'src'}, # tell distutils packages are under src
package_dir
=
{'':'src'}, # tell distutils packages are under src
include_package_data
=
True, # include everything in source control
include_package_data
=
True, # include everything in source control
# ...but exclude README.txt from all packages
# ...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
The ``exclude_package_data`` option is a dictionary mapping package names to
...
@@ -1035,21 +1035,21 @@ for our hypothetical blogging tool::
...
@@ -1035,21 +1035,21 @@ for our hypothetical blogging tool::
setup(
setup(
# ...
# ...
entry_points
=
{'blogtool.parsers': '.rst = some_module:SomeClass'}
entry_points
=
{'blogtool.parsers': '.rst = some_module:SomeClass'}
)
)
setup(
setup(
# ...
# ...
entry_points
=
{'blogtool.parsers': ['.rst = some_module:a_func']}
entry_points
=
{'blogtool.parsers': ['.rst = some_module:a_func']}
)
)
setup(
setup(
# ...
# ...
entry_points
=
"""
entry_points
=
"""
[blogtool.parsers]
[blogtool.parsers]
.rst = some.nested.module:SomeClass.some_classmethod [reST]
.rst = some.nested.module:SomeClass.some_classmethod [reST]
""",
""",
extras_require
= dict(reST =
"Docutils>=0.3.5")
extras_require
=dict(reST=
"Docutils>=0.3.5")
)
)
The ``entry_points`` argument to ``setup()`` accepts either a string with
The ``entry_points`` argument to ``setup()`` accepts either a string with
...
@@ -1343,7 +1343,7 @@ participates in. For example, the ZopeInterface project might do this::
...
@@ -1343,7 +1343,7 @@ participates in. For example, the ZopeInterface project might do this::
setup(
setup(
# ...
# ...
namespace_packages
=
['zope']
namespace_packages
=
['zope']
)
)
because it contains a ``zope.interface`` package that lives in the ``zope``
because it contains a ``zope.interface`` package that lives in the ``zope``
...
@@ -1599,7 +1599,7 @@ to specify your ``install_requires`` (or other requirements) to include
...
@@ -1599,7 +1599,7 @@ to specify your ``install_requires`` (or other requirements) to include
.. code-block:: python
.. code-block:: python
install_requires
=
["OtherProject>=0.2a1.dev-r143,==dev"]
install_requires
=
["OtherProject>=0.2a1.dev-r143,==dev"]
The above example says, "I really want at least this particular development
The above example says, "I really want at least this particular development
revision number, but feel free to follow and use an ``#egg=OtherProject-dev``
revision number, but feel free to follow and use an ``#egg=OtherProject-dev``
...
@@ -2303,7 +2303,7 @@ available:
...
@@ -2303,7 +2303,7 @@ available:
setup(
setup(
# ...
# ...
test_suite
=
"my_package.tests.test_all"
test_suite
=
"my_package.tests.test_all"
)
)
If you did not set a ``test_suite`` in your ``setup()`` call, and do not
If you did not set a ``test_suite`` in your ``setup()`` call, and do not
...
@@ -2427,7 +2427,7 @@ project's setup script::
...
@@ -2427,7 +2427,7 @@ project's setup script::
setup(
setup(
# ...
# ...
entry_points
=
{
entry_points
=
{
"distutils.commands": [
"distutils.commands": [
"foo = mypackage.some_module:foo",
"foo = mypackage.some_module:foo",
],
],
...
@@ -2459,7 +2459,7 @@ distutils extension project's setup script::
...
@@ -2459,7 +2459,7 @@ distutils extension project's setup script::
setup(
setup(
# ...
# ...
entry_points
=
{
entry_points
=
{
"distutils.commands": [
"distutils.commands": [
"foo = mypackage.some_module:foo",
"foo = mypackage.some_module:foo",
],
],
...
@@ -2521,7 +2521,7 @@ project that uses the argument::
...
@@ -2521,7 +2521,7 @@ project that uses the argument::
setup(
setup(
# ...
# ...
entry_points
=
{
entry_points
=
{
"distutils.setup_keywords": [
"distutils.setup_keywords": [
"foo_bar = setuptools.dist:assert_string_list",
"foo_bar = setuptools.dist:assert_string_list",
],
],
...
@@ -2540,7 +2540,7 @@ a file. Here's what the writer utility looks like::
...
@@ -2540,7 +2540,7 @@ a file. Here's what the writer utility looks like::
argname = os.path.splitext(basename)[0]
argname = os.path.splitext(basename)[0]
value = getattr(cmd.distribution, argname, None)
value = getattr(cmd.distribution, argname, None)
if value is not None:
if value is not None:
value = '\n'.join(value)
+
'\n'
value = '\n'.join(value)
+
'\n'
cmd.write_or_delete_file(argname, filename, value)
cmd.write_or_delete_file(argname, filename, value)
As you can see, ``egg_info.writers`` entry points must be a function taking
As you can see, ``egg_info.writers`` entry points must be a function taking
...
@@ -2582,9 +2582,9 @@ called "foobar", you would write a function something like this:
...
@@ -2582,9 +2582,9 @@ called "foobar", you would write a function something like this:
And you would register it in a setup script using something like this::
And you would register it in a setup script using something like this::
entry_points
=
{
entry_points
=
{
"setuptools.file_finders": [
"setuptools.file_finders": [
"foobar = my_foobar_module:find_files_for_foobar"
"foobar = my_foobar_module:find_files_for_foobar"
,
]
]
}
}
...
@@ -2664,4 +2664,3 @@ set of steps to reproduce.
...
@@ -2664,4 +2664,3 @@ set of steps to reproduce.
.. _distutils-sig mailing list: http://mail.python.org/pipermail/distutils-sig/
.. _distutils-sig mailing list: http://mail.python.org/pipermail/distutils-sig/
.. _setuptools bug tracker: https://github.com/pypa/setuptools/
.. _setuptools bug tracker: https://github.com/pypa/setuptools/
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