X Tutup
Skip to content

Support custom Jinja extensions in release notes templates #1402

@bilelomrani1

Description

@bilelomrani1

Feature Request

Description

Custom Jinja extensions configured via [tool.semantic_release.changelog.environment] are only available in
changelog templates, not in release notes templates (.release_notes.md.j2).

When using a custom extension:

[tool.semantic_release.changelog.environment]
extensions = ["my_package.ext:MyCustomExtension"]

CHANGELOG.md.j2 can use filters from MyCustomExtension but .release_notes.md.j2 fails with "No filter named 'my_filter'"

This is because generate_release_notes() in changelog_writer.py creates a separate, non-configurable environment that ignores user settings.

Use cases

Users who customize their changelog templates with extensions usually expect the same formatting in GitHub releases, or at least being able to reuse custom Jinja filters etc.

Possible implementation

Apply the same changelog.environment configuration when creating the release notes Jinja environment in
generate_release_notes().

Alternative solutions

If intentional, document that release notes don't support custom extensions

This does not seem to be a very complex fix, happy to send a PR for this if we agree on the feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureA new feature or a feature requesttriagewaiting for initial maintainer review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup