@@ -36,21 +36,30 @@ number of your project:
36
36
.. note ::
37
37
38
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):
39
+ thing by instead placing the following in the project's
40
+ :file: `setup.cfg ` file (replacing "package" with the import name of the
41
+ package):
41
42
42
43
.. code-block :: ini
43
44
44
45
[metadata]
45
46
version = attr: package.__version__
46
47
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.
48
+ As of the release of setuptools 61.0.0, one can specify the
49
+ version dynamically in the project's :file: `pyproject.toml ` file.
51
50
52
- Also, please be aware that declarative config indicators, including the
53
- ``attr: `` directive, are not supported in parameters to ``setup.py ``.
51
+ .. code-block :: toml
52
+
53
+ [project]
54
+ name = "package"
55
+ dynamic = ["version"]
56
+
57
+ [tool.setuptools.dynamic]
58
+ version = {attr = "package.__version__"}
59
+
60
+ Please be aware that declarative config indicators, including the
61
+ ``attr: `` directive, are not supported in parameters to
62
+ :file: `setup.py `.
54
63
55
64
#. Use an external build tool that either manages updating both locations, or
56
65
offers an API that both locations can use.
0 commit comments