Ouranosinc / cookiecutter-pypackage

Cookiecutter template for a Python package.
BSD 3-Clause "New" or "Revised" License
6 stars 1 forks source link

Adding replaceable release notes to the cookiecutter #41

Closed Zeitsperre closed 4 months ago

Zeitsperre commented 5 months ago

Description

This is a desirable feature that relies on changes in bump-my-version. Adapted from code originally introduced in #38.

It would be great to have a way of replacing the entries in the release notes on each version bump. Unfortunately, this doesn't work with the current implementation of bump-my-version when using build-incrementing patterns (see: https://github.com/callowayproject/bump-my-version/issues/189).

For reference, one way of using both cookiecutter and jinja templating to have the underline of the built project respect the length of the entry line would resemble the following:

[[tool.bumpversion.files]]
filename = "CHANGES.rst"
search = """\
`Unreleased <https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}>`_ (latest)
{{ '-' * ('`Unreleased <https://github.com/' + cookiecutter.github_username + '/' + cookiecutter.project_slug + '>`_ (latest)')|length }}
"""
replace = """\
`Unreleased <https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}>`_ (latest)
{{ '-' * ('`Unreleased <https://github.com/' + cookiecutter.github_username + '/' + cookiecutter.project_slug + '>`_ (latest)')|length }}

Contributors:

Changes
^^^^^^^
* No change.

Fixes
^^^^^
* No change.

.. _changes_{new_version}:

`v{new_version} <https://github.com/{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}/tree/{new_version}>`_
{{ '-' * ('`v' + cookiecutter.version + ' <https://github.com/' + cookiecutter.github_username + '/' + cookiecutter.project_slug + '/tree/' + cookiecutter.version + '>`_ (latest)')|length }}
"""