-
Notifications
You must be signed in to change notification settings - Fork 128
Need a way to set the order of fragments #437
Copy link
Copy link
Closed
Description
The new way of defining custom fragments uses a dictionary that is unfortunately sorted alphabetically by tomli.
For example this is from my Markdown tutorial in #436:
{'tool': {'towncrier': {'directory': 'changelog.d',
'filename': 'CHANGELOG.md',
'fragment': {'added': {'name': 'Added'},
'changed': {'name': 'Changed'},
'deprecated': {'name': 'Deprecated'},
'fixed': {'name': 'Fixed'},
'removed': {'name': 'Removed'},
'security': {'name': 'Security'}},
'issue_format': '[#{issue}](https://github.com/twisted/my-project/issues/{issue})',
'start_string': '<!-- towncrier release notes start '
'-->\n',
'template': 'changelog.d/changelog_template.jinja',
'title_format': '## '
'[{version}](https://github.com/twisted/my-project/tree/{version}) '
'- {project_date}',
'underlines': ['', '', '']}}}The fragment types are defined as:
[tool.towncrier.fragment.security]
name = "Security"
[tool.towncrier.fragment.removed]
name = "Removed"
[tool.towncrier.fragment.deprecated]
name = "Deprecated"
[tool.towncrier.fragment.added]
name = "Added"
[tool.towncrier.fragment.changed]
name = "Changed"
[tool.towncrier.fragment.fixed]
name = "Fixed"
In hindsight, it's unfortunate we've switched away from using a list for that but it is what it is.
I can think of two way to solve this:
- add an
orderkey to the fragments:
[tool.towncrier.fragment.security]
name = "Security"
order = 1
[tool.towncrier.fragment.removed]
name = "Removed"
order = 2- add an option:
[tool.towncrier]
category_order = ["security", "removed", "..."]I think I prefer option 2, because you don't have to re-number all entries if you change the order.
The question is what would happen if a catefory is missing – I would suggest an error.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels