diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 2b42657e..31022e18 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -30,19 +30,19 @@ Step-by-step
- Define the final release version you are preparing.
- towncrier uses `CalVer `_ of the form ``YY.MM.micro`` with the micro version just incrementing.
- - Normalize the version according to `PEP 440 `_.
+ - Normalize the version according to `incremental `_.
- This requires that ``towncrier[dev]`` extra is installed.
- ``venv/bin/python admin/canonicalize_version.py 19.09.00-rc1``
- - Outputs ``19.9rc1`` which is the form to be used.
+ - Outputs ``19.9.0.rc1`` which is the form to be used.
-- Create a release branch with a name of the form ``release-19.9`` starting from the ``master`` branch.
+- Create a release branch with a name of the form ``release-19.9.0`` starting from the ``master`` branch.
- On the new release branch you will commit all tagged release candidate commits as well as the final tagged release commit.
- Update the version to the release candidate with the first being ``rc1`` (as opposed to 0).
- - In ``src/towncrier/_version.py`` the version is set using ``incremental`` such as ``__version__ = Version('towncrier', 19, 9, release_candidate=1)``
+ - In ``src/towncrier/_version.py`` the version is set using ``incremental`` such as ``__version__ = Version('towncrier', 19, 9, 0, release_candidate=1)``
- Run ``venv/bin/towncrier build --yes`` to build the the newsfragments into the release notes document and to automatically remove the newsfragment files.
@@ -54,7 +54,7 @@ Step-by-step
- Request a review and address raised concerns until receiving an approval.
-- Tag that commit such as ``19.9rc1`` and push the tag to the primary repository.
+- Tag that commit such as ``19.9.0.rc1`` and push the tag to the primary repository.
- This will result in another build which will publish to PyPI.
- Confirm the presence of the release on PyPI.
@@ -73,7 +73,7 @@ Step-by-step
- If ready for a final release, remove the release candidate indicator from the version.
- - Edit ``src/towncrier/_version.py`` such as ``__version__ = Version('towncrier', 19, 9)`` to remove the release candidate indication.
+ - Edit ``src/towncrier/_version.py`` such as ``__version__ = Version('towncrier', 19, 9, 0)`` to remove the release candidate indication.
- Return to the towncrier build step and continue.
diff --git a/admin/canonicalize_version.py b/admin/canonicalize_version.py
index d309ad60..7d80717f 100644
--- a/admin/canonicalize_version.py
+++ b/admin/canonicalize_version.py
@@ -1,14 +1,31 @@
import click
+import incremental
import packaging.utils
@click.command()
@click.argument("version")
def cli(version):
- """Canonicalizes the passed version according to PEP 517."""
- canonicalized_version = packaging.utils.canonicalize_version(version)
+ """Canonicalizes the passed version according to incremental."""
- click.echo(canonicalized_version)
+ parsed_version = packaging.utils.Version(version)
+
+ release_candidate = None
+ if parsed_version.pre is not None:
+ if parsed_version.pre[0] == 'rc':
+ release_candidate = parsed_version.pre[1]
+
+ incremental_version = incremental.Version(
+ package="",
+ major=parsed_version.major,
+ minor=parsed_version.minor,
+ micro=parsed_version.micro,
+ release_candidate=release_candidate,
+ post=parsed_version.post,
+ dev=parsed_version.dev,
+ )
+
+ click.echo(incremental_version.public())
if __name__ == "__main__":
diff --git a/src/towncrier/newsfragments/329.misc.rst b/src/towncrier/newsfragments/329.misc.rst
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/src/towncrier/newsfragments/329.misc.rst
@@ -0,0 +1 @@
+