Skip to content

Commit 0fa6272

Browse files
committed
Update changelog and add documentation about usage of the feature.
1 parent bf15ea9 commit 0fa6272

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
v3.4.0
2+
======
3+
4+
* fix #181 - add support for projects built under setuptools declarative config
5+
by way of the setuptools.finalize_distribution_options hook in Setuptools 42.
6+
17
* fix #305 - ensure the git file finder closes filedescriptors even when errors happen
28

39
v3.3.3

README.rst

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,63 @@ It also handles file finders for the supported SCMs.
1313
.. image:: https://tidelift.com/badges/github/pypa/setuptools_scm
1414
:target: https://tidelift.com/subscription/pkg/pypi-setuptools_scm?utm_source=pypi-setuptools_scm&utm_medium=readme
1515

16+
``pyproject.toml`` usage
17+
------------------------
18+
19+
The preferred way to configure ``setuptools_scm`` is to author
20+
settings in a ``tool.setuptools_scm`` section of ``pyproject.toml``.
21+
22+
This feature requires Setuptools 42 or later, released in Nov, 2019.
23+
If your project needs to support build from sdist on older versions
24+
of Setuptools, you will need to also implement the ``setup.py usage``
25+
for those legacy environments.
26+
27+
First, ensure that ``setuptools_scm`` is present during the project's
28+
built step by specifying it as one of the build requirements.
29+
30+
.. code:: ini
31+
32+
# pyproject.toml
33+
[build-system]
34+
requires = ["setuptools>=42", "wheel", "setuptools_scm[toml]>=3.4"]
35+
36+
Note that the ``toml`` extra must be supplied.
37+
38+
That will be sufficient to require ``setuptools_scm`` for projects
39+
that support PEP 518 (`pip <https://pypi.org/project/pip>`_ and
40+
`pep517 <https://pypi.org/project/pep517/>`_). Many tools,
41+
especially those that invoke ``setup.py`` for any reason, may
42+
continue to rely on ``setup_requires``. For maximum compatibility
43+
with those uses, consider also including a ``setup_requires`` directive
44+
(described below in ``setup.py usage`` and ``setup.cfg``).
45+
46+
To enable version inference, add this section to your pyproject.toml:
47+
48+
.. code:: ini
49+
50+
# pyproject.toml
51+
[tools.setuptools_scm]
52+
53+
Including this section is comparable to supplying
54+
``use_scm_version=True`` in ``setup.py``. Additionally,
55+
include arbitrary keyword arguments in that section
56+
to be supplied to ``get_version()``. For example::
57+
58+
.. code:: ini
59+
60+
# pyproject.toml
61+
[tools.setuptools_scm]
62+
write_to = pkg/version.py
63+
64+
1665
``setup.py`` usage
1766
------------------
1867

68+
The following settings are considered legacy behavior and
69+
superseded by the ``pyproject.toml`` usage, but for maximal
70+
compatibility, projects may also supply the configuration in
71+
this older form.
72+
1973
To use ``setuptools_scm`` just modify your project's ``setup.py`` file
2074
like this:
2175

0 commit comments

Comments
 (0)