from__future__importannotationsfromtypingimportTYPE_CHECKING# NOTE: use backport with newer API than stdlibfromimportlib_resourcesimportfilesifTYPE_CHECKING:frompathlibimportPathfromjinja2importEnvironmentfromsemantic_release.changelog.release_historyimportReleasefromsemantic_release.versionimportVersion
[docs]defget_release_notes_template(template_dir:Path)->str:"""Read the project's template for release notes, falling back to the default."""fname=template_dir/".release_notes.md.j2"try:returnfname.read_text(encoding="utf-8")exceptFileNotFoundError:return(files("semantic_release").joinpath("data/templates/release_notes.md.j2").read_text(encoding="utf-8"))