Skip to content

#714 feature(create): added option 'index' which allows direct access to indexed snippets#735

Open
tirolerstefan wants to merge 11 commits into
twisted:trunkfrom
tirolerstefan:create_using_index_#714
Open

#714 feature(create): added option 'index' which allows direct access to indexed snippets#735
tirolerstefan wants to merge 11 commits into
twisted:trunkfrom
tirolerstefan:create_using_index_#714

Conversation

@tirolerstefan

@tirolerstefan tirolerstefan commented May 27, 2026

Copy link
Copy Markdown

Fixes #714

Towncried currently adds an index if a snippet already exists, e.g. issue-1234.feat.md is available, so issue-1234.feat.1.md is created.

We have a graphical tool for changelog snippet creation and wanted to directly access the indexed snippets - so an overwrite is possible.

With this change, a new option "--index" is added.

e.g.

towncrier create --dir .../changelogs/preliminary --config .../config/changelogs/towncrier.toml --section BLA --content "test3<br/>
    another snippet" --index 8 ISSUE-1000.feat.md
Created news fragment at .../changelogs/preliminary/BLA/ISSUE-1000.feat.8.md

If index == 0, the filename without index is accessed.
If index > 0, the index is added to the filename.

If option "index" is not passed, the tool behaves as before - the next index is chosen.

@tirolerstefan tirolerstefan requested a review from a team as a code owner May 27, 2026 06:26
@adiroiban adiroiban changed the title feature(create): added option 'index' which allows direct access to indexed snippets #714 feature(create): added option 'index' which allows direct access to indexed snippets May 27, 2026
@adiroiban

Copy link
Copy Markdown
Member

Hi Stefan.

Thanks for the PR.

It might be the case that our pre-commit is not yet ready for Python 3.15

I will take a look

@tirolerstefan

Copy link
Copy Markdown
Author

Thanks a lot for checking this.
Note: Currently I'm using Python 3.12.3 on Ubuntu 24.04.

@adiroiban

Copy link
Copy Markdown
Member

Can you push your changes using git --no-verify ... I will check the pre-commit errors.
They might not be related to this PR

@tirolerstefan

tirolerstefan commented May 27, 2026 via email

Copy link
Copy Markdown
Author

@adiroiban adiroiban left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR and sorry for the late review.

I left a few inline comments.

To merge, this PR needs updated autoamted tests.

Thanks again

Comment thread src/towncrier/newsfragments/714.feature.rst Outdated
bar

"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this change needed?

@tirolerstefan tirolerstefan Jun 9, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was one of the "auto fixes" of pre-commit.
no, it's not needed in my eyes, but i have to commit it using "--no-verify".
if you don't mind, i will leave it as it is to satisfy the pre-commit tools.

Comment thread src/towncrier/create.py Outdated
Comment thread src/towncrier/create.py Outdated
Comment thread src/towncrier/create.py
help="The section to create the fragment for.",
)
@click.option(
"--index",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Index is kind of generic...
Maybe it's best to be more explicit to prevent future conflicts and confusions/

Suggested change
"--index",
"--issue-index",

I don't know if "index" is the best name for this feature... maybe we can call it --sub-issue or someting like that

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm, it's like an index - 0 is the first fragment, 1 the next, etc. but i can live with any text.
"sub-issue" is totally ok, "sub-fragment" or "fragment-number", "fragment-id", "sub-id"?

@tirolerstefan

tirolerstefan commented Jun 9, 2026

Copy link
Copy Markdown
Author

hi @adiroiban - thanks, i have added my comments above and pushed a new commit.
waiting for the final naming of the option, then i will adapt this, too.

@tirolerstefan tirolerstefan requested a review from adiroiban June 15, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New option 'index'

2 participants