Skip to content

Commit 29aea30

Browse files
authored
Merge pull request #758 from jwodder/mention-attr
2 parents 70fb13c + 7737a58 commit 29aea30

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,22 @@ 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.
51+
3652

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

0 commit comments

Comments
 (0)