Skip to content

Commit 00352a2

Browse files
committed
README: Add setup.cfg usage example
This also highlights issues with the '[egg_info]' configuration section in 'setup.cfg'. Signed-off-by: Stephen Finucane <[email protected]>
1 parent e4d8684 commit 00352a2

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

README.rst

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,49 @@ example:
5757
# package is not installed
5858
pass
5959
60+
You can also confirm the version number locally via ``setup.py``:
61+
62+
.. code-block:: shell
63+
64+
$ python setup.py --version
65+
66+
.. note::
67+
68+
If you see unusual version numbers for packages but ``python setup.py
69+
--version`` reports the expected version number, ensure ``[egg_info]`` is
70+
not defined in ``setup.cfg``.
71+
72+
73+
``setup.cfg``
74+
-------------
75+
76+
If using `setuptools 30.3.0
77+
<https://setuptools.readthedocs.io/en/latest/setuptools.html#configuring-setup-using-setup-cfg-files>`_
78+
or greater, you can store ``setup_requires`` configuration in ``setup.cfg``.
79+
However, ``use_scm_version`` must still be placed in ``setup.py``. For example:
80+
81+
.. code:: python
82+
83+
# setup.py
84+
from setuptools import setup
85+
setup(
86+
use_scm_version=True,
87+
)
88+
89+
.. code:: ini
90+
91+
# setup.cfg
92+
[metadata]
93+
...
94+
95+
[options]
96+
setup_requires =
97+
setuptools_scm
98+
...
99+
100+
If using this, you must neither the ``[metadata] version`` option nor the
101+
``[egg_info]`` section are not defined.
102+
60103

61104
Programmatic usage
62105
------------------

0 commit comments

Comments
 (0)