Skip to content

Commit accc883

Browse files
committed
Update tutorial for accuracy around detecting versions
1 parent 396a84b commit accc883

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

docs/tutorial.rst

+11-5
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,19 @@ The ``.gitignore`` will remain and keep Git from not tracking the directory.
5151
Detecting Dates & Versions
5252
--------------------------
5353

54-
``towncrier`` needs to know what version your project is, and there are two ways you can give it:
54+
``towncrier`` needs to know what version your project is.
5555

56-
- For Python 2/3-compatible projects, a ``__version__`` in the top level package.
57-
This can be either a string literal, a tuple, or an `Incremental <https://github.com/twisted/incremental>`_ version.
58-
- Manually passing ``--version=<myversionhere>`` when interacting with ``towncrier``.
56+
For Python projects, the version can be automatically determined in one of the following ways:
5957

60-
As an example, if your package doesn't have a ``__version__``, you can manually specify it when calling ``towncrier`` on the command line with the ``--version`` flag::
58+
- if the project is installed, the version can be read from the package's metadata
59+
- the version can be provided in a ``__version__`` attribute of the top level package (as a string literal, a tuple, or an `Incremental <https://github.com/twisted/incremental>`_ version)
60+
61+
For other projects, you can store the version in the ``towncrier.toml`` file::
62+
63+
[tool.towncrier]
64+
version = "1.0.0"
65+
66+
If you don't want to store the version, you can manually pass ``--version=<myversionhere>`` whenever interacting with ``towncrier``. For example::
6167

6268
$ towncrier build --version=1.2.3post4
6369

0 commit comments

Comments
 (0)