Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions source/guides/single-sourcing-package-version.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ number of your project:
...
)

.. note::

As of the release of setuptools 46.4.0, one can accomplish the same
thing by instead placing the following in the project's ``setup.cfg``
file (replacing "package" with the import name of the package):

.. code-block:: ini

[metadata]
version = attr: package.__version__

Earlier versions of setuptools implemented the ``attr:`` directive by
importing the module, but setuptools 46.4.0 added rudimentary AST
analysis so that ``attr:`` can function without having to import any of
the package's dependencies.


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