twisted / towncrier

Manage the release notes for your project.

Home Page:https://towncrier.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FileNotFoundError, Failed to list the news fragment files

jaraco opened this issue · comments

After adopting towncrier for the hundreds of projects that depend on jaraco/skeleton, I've been pleased to say that it has helped streamline the changelog generation.

I've tried as much as possible to minimize the amount of config required (relying on towncrier to provide best practices by default). Unfortunately, if I try to cut a release when there are no newsfragments, the "finalize" step fails:

 pytest-checkdocs main @ tox -e finalize
finalize: commands[0]> python -m jaraco.develop.finalize
Loading template...
Finding news fragments...
Failed to list the news fragment files.
FileNotFoundError: [Errno 2] No such file or directory: '/Users/jaraco/code/jaraco/pytest-checkdocs/newsfragments'

I can work around the issue by first running mkdir -p newsfragments, but I'd rather not have to add that step. I know I can create a permanent newsfragments directory in every project, but that requires adding a sentinel file to keep it present. And given that towncrier already works well to create that directory when it doesn't exist, I'd like it to fall back to the degenerate behavior when running build.

Can you update towncrier build to treat a missing fragments directory as the same as an empty directory, same as towcrier create?

Thanks for the report.

if I try to cut a release when there are no newsfragments,

I am not sure I understand the use case here.
If there are no newsfragments, it means there are no changes since the last release...so why do a release?


Can you update towncrier build to treat a missing fragments directory as the same as an empty directory, same as towcrier create?

I would say that this is a feature and can help for example detect a misconfiguration / typo in the config.

If you want to build the release notes but the release notes fragments are not to be found, most probably this is an issue.


But as mentioned before, it might be that I don't understand the use case.

My suggesting is to try to send a PR starting with updating the docs to document this functionality. My hope is in this way, it should easier to understand the context in which towncrier is used.

Regards

I am not sure I understand the use case here.
If there are no newsfragments, it means there are no changes since the last release...so why do a release?

Sometimes, the changes are too minor to mention (fixing typos or package metadata) but I still want to get them out to catch unexpected regressions or to limit the number of uninteresting changes in future releases. Towncrier supports a null newsfragments set and uses no significant changes when that's the case. For example, see the v7.7.1 release of calendra, where the badge had some syntax errors and I wanted to get those repaired so they'd appear correctly in PyPI, even though it had no user-facing impact and wasn't worth documenting twice or v2.10.1 of pytest-checkdocs where the project skeleton was updated and an old deprecation suppression was removed.

This feature (the ability to release without making a fuss) was one of the must-have features for me to adopt towncrier. Because I maintain hundreds of packages, my maintenance process needs to be featherweight.

I would say that this is a feature and can help for example detect a misconfiguration / typo in the config.

If that's the case, then shouldn't also create fail if the directory doesn't exist? I seems to me that if the philosophy allows creation of entries without the directory and it allows building an empty directory with no entries, it should also allow building without the directory, especially because it's an unnecessary nuisance to require each project to manage retention of that directory in version control.

If you want to build the release notes but the release notes fragments are not to be found, most probably this is an issue.

In my case, it's not. Towncrier provides value by providing a unified process for finalizing the release (adding the heading, which itself communicates the version and the date it was tagged), even if there were no noteworthy changes. And the fact that the code already supports rendering an empty directory suggests that a misconfiguration doesn't necessarily justify the hard fail.

My suggesting is to try to send a PR starting with updating the docs to document this functionality.

Will do. Thanks.

Hi,

In release 22.12.0 , this #428 was merged.

Would that work for you ?


You can now create fragments that are not associated with issues. Start the name of the fragment with + (e.g. +anything.feature). The content of these orphan news fragments will be included in the release notes, at the end of the category corresponding to the file extension.

To help quickly create a unique orphan news fragment, towncrier create +.feature will append a random string to the base name of the file, to avoid name collisions. (#428)

Would that work for you ?

I've used and appreciate that feature, but it doesn't address the reported issue. I'm still planning to create a PR. You can assign this issue to me if you like.

Thanks for the feedback. I wasn't sure what is the use case here.

For the towncrier "phiplosophy" it makes no sense to make a release without any changes.
An any change should have a news fragment file :)

You can make a change without having a ticket using the #428 feature.


If I understand correclty, you are asking for the following feature:

Run towncrier create even if there are no news fragment.
It should not fail.
It should create a new section with the current version and date and mention that no changes were done in the release.

Is that correct?


As you mention, if towncrier already works with an empty dir, and this helps with your maintance work, I think it makes to ignore the missing fragment dir and just consider it empty.

If you have a misconfiguration, you will see the empty release and then you can troubleshoot.

One of the goals of towncrier is to make the life easier for release managers :)


No need to assign this.

You can work when you have time.

It should create a new section with the current version and date and mention that no changes were done in the release.

Correct, same as for an empty directory.