@@ -18,15 +18,7 @@ to the ``setup()`` function (declarative config).
1818This approach not only allows automation scenarios but also reduces
1919boilerplate code in some cases.
2020
21- .. note ::
22-
23- This implementation has limited compatibility with the distutils2-like
24- ``setup.cfg `` sections used by the ``pbr `` and ``d2to1 `` packages.
25-
26- Namely: only metadata-related keys from ``metadata `` section are supported
27- (except for ``description-file ``); keys from ``files ``, ``entry_points ``
28- and ``backwards_compat `` are not supported.
29-
21+ .. _example-setup-config :
3022
3123.. code-block :: ini
3224
@@ -58,6 +50,10 @@ boilerplate code in some cases.
5850 * = *.txt, *.rst
5951 hello = *.msg
6052
53+ [options.entry_points]
54+ console_scripts =
55+ executable-name = package.module:function
56+
6157 [options.extras_require]
6258 pdf = ReportLab>=1.2; RXP
6359 rest = docutils>=0.3; pack ==1.1, ==1.3
@@ -156,10 +152,9 @@ Special directives:
156152
157153* ``file: `` - Value is read from a list of files and then concatenated
158154
159-
160- .. note ::
161- The ``file: `` directive is sandboxed and won't reach anything outside
162- the directory containing ``setup.py ``.
155+ .. note ::
156+ The ``file: `` directive is sandboxed and won't reach anything outside
157+ the directory containing ``setup.py ``.
163158
164159
165160Metadata
@@ -169,11 +164,11 @@ Metadata
169164 The aliases given below are supported for compatibility reasons,
170165 but their use is not advised.
171166
172- ============================== ================= ================= =============== =====
167+ ============================== ================= ================= =============== ==========
173168Key Aliases Type Minimum Version Notes
174- ============================== ================= ================= =============== =====
169+ ============================== ================= ================= =============== ==========
175170name str
176- version attr:, file:, str 39.2.0 (1)
171+ version attr:, file:, str 39.2.0 [ #meta-1 ]_
177172url home-page str
178173download_url download-url str
179174project_urls dict 38.3.0
@@ -192,28 +187,29 @@ platforms platform list-comma
192187provides list-comma
193188requires list-comma
194189obsoletes list-comma
195- ============================== ================= ================= =============== =====
190+ ============================== ================= ================= =============== ==========
196191
197- .. note ::
198- A version loaded using the ``file: `` directive must comply with PEP 440.
199- It is easy to accidentally put something other than a valid version
200- string in such a file, so validation is stricter in this case.
192+ **Notes **:
193+
194+ .. [#meta-1 ] The ``version `` file attribute has only been supported since 39.2.0.
195+
196+ A version loaded using the ``file: `` directive must comply with PEP 440.
197+ It is easy to accidentally put something other than a valid version
198+ string in such a file, so validation is stricter in this case.
201199
202- Notes:
203- 1. The ``version `` file attribute has only been supported since 39.2.0.
204200
205201 Options
206202-------
207203
208- ======================= =================================== =============== =====
204+ ======================= =================================== =============== =========
209205Key Type Minimum Version Notes
210- ======================= =================================== =============== =====
206+ ======================= =================================== =============== =========
211207zip_safe bool
212208setup_requires list-semi
213209install_requires list-semi
214- extras_require section
210+ extras_require section [ #opt-2 ]_
215211python_requires str
216- entry_points file:, section
212+ entry_points file:, section 51.0.0
217213use_2to3 bool
218214use_2to3_fixers list-comma
219215use_2to3_exclude_fixers list-comma
@@ -223,38 +219,74 @@ eager_resources list-comma
223219dependency_links list-comma
224220tests_require list-semi
225221include_package_data bool
226- packages find:, find_namespace:, list-comma
222+ packages find:, find_namespace:, list-comma [ #opt-3 ]_
227223package_dir dict
228- package_data section (1)
224+ package_data section [ #opt-1 ]_
229225exclude_package_data section
230226namespace_packages list-comma
231227py_modules list-comma
232228data_files dict 40.6.0
233- ======================= =================================== =============== =====
234-
235- .. note ::
236-
237- **packages ** - The ``find: `` and ``find_namespace: `` directive can be further configured
238- in a dedicated subsection ``options.packages.find ``. This subsection
239- accepts the same keys as the ``setuptools.find_packages `` and the
240- ``setuptools.find_namespace_packages `` function:
241- ``where ``, ``include ``, and ``exclude ``.
242-
243- **find_namespace directive ** - The ``find_namespace: `` directive is supported since Python >=3.3.
244-
245-
246- Notes:
247- 1. In the ``package_data `` section, a key named with a single asterisk (``* ``)
248- refers to all packages, in lieu of the empty string used in ``setup.py ``.
249-
250- 2. In the ``extras_require `` section, values are parsed as ``list-semi ``. This implies that in
251- order to include markers, they **must ** be *dangling *:
252-
253- .. code-block :: ini
254-
255- [options.extras_require]
256- rest = docutils>=0.3; pack ==1.1, ==1.3
257- pdf =
258- ReportLab>=1.2
259- RXP
260- importlib-metadata; python_version < "3.8"
229+ ======================= =================================== =============== =========
230+
231+ **Notes **:
232+
233+ .. [#opt-1 ] In the ``package_data `` section, a key named with a single asterisk
234+ (``* ``) refers to all packages, in lieu of the empty string used in ``setup.py ``.
235+
236+ .. [#opt-2 ] In the ``extras_require `` section, values are parsed as ``list-semi ``.
237+ This implies that in order to include markers, they **must ** be *dangling *:
238+
239+ .. code-block :: ini
240+
241+ [options.extras_require]
242+ rest = docutils>=0.3; pack ==1.1, ==1.3
243+ pdf =
244+ ReportLab>=1.2
245+ RXP
246+ importlib-metadata; python_version < "3.8"
247+
248+ .. [#opt-3 ] The ``find: `` and ``find_namespace: `` directive can be further configured
249+ in a dedicated subsection ``options.packages.find ``. This subsection accepts the
250+ same keys as the ``setuptools.find_packages `` and the
251+ ``setuptools.find_namespace_packages `` function:
252+ ``where ``, ``include ``, and ``exclude ``.
253+
254+ The ``find_namespace: `` directive is supported since Python >=3.3.
255+
256+
257+ Compatibility with other tools
258+ ==============================
259+
260+ Historically, several tools explored declarative package configuration
261+ in parallel. And several of them chose to place the packaging
262+ configuration within the project's :file: `setup.cfg ` file.
263+ One of the first was ``distutils2 ``, which development has stopped in
264+ 2013. Other include ``pbr `` which is still under active development or
265+ ``d2to1 ``, which was a plug-in that backports declarative configuration
266+ to ``distutils ``, but has had no release since Oct. 2015.
267+ As a way to harmonize packaging tools, ``setuptools ``, having held the
268+ position of *de facto * standard, has gradually integrated those
269+ features as part of its core features.
270+
271+ Still this has lead to some confusion and feature incompatibilities:
272+
273+ - some tools support features others don't;
274+ - some have similar features but the declarative syntax differs;
275+
276+ The table below tries to summarize the differences. But, please, refer
277+ to each tool documentation for up-to-date information.
278+
279+ =========================== ========== ========== ===== ===
280+ feature setuptools distutils2 d2to1 pbr
281+ =========================== ========== ========== ===== ===
282+ [metadata] description-file S Y Y Y
283+ [files] S Y Y Y
284+ entry_points Y Y Y S
285+ [backwards_compat] N Y Y Y
286+ =========================== ========== ========== ===== ===
287+
288+ Y: supported, N: unsupported, S: syntax differs (see
289+ :ref: `above example<example-setup-config> `).
290+
291+ Also note that some features were only recently added to ``setuptools ``.
292+ Please refer to the previous sections to find out when.
0 commit comments