Skip to content

Commit 62ad886

Browse files
committed
Mention enhanced attr: directive in single-sourcing option #1
1 parent 39fdb02 commit 62ad886

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

source/guides/single-sourcing-package-version.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ number of your project:
3333
...
3434
)
3535

36+
.. note::
37+
38+
As of the release of setuptools 46.4.0, one can accomplish the same
39+
thing by instead placing the following in the project's ``setup.cfg``
40+
file (replacing "package" with the import name of the package):
41+
42+
.. code-block:: ini
43+
44+
[metadata]
45+
version = attr:package.__version__
46+
47+
Earlier versions of setuptools implemented the ``attr:`` directive by
48+
importing the module, but setuptools 46.4.0 added rudimentary AST
49+
analysis so that ``attr:`` can function without having to import any of
50+
the package's dependencies.
3651

3752
#. Use an external build tool that either manages updating both locations, or
3853
offers an API that both locations can use.

0 commit comments

Comments
 (0)