Prefer pathlib for read/write operations#591
Conversation
b6258b0 to
f013fba
Compare
|
Oh, this change fails on Python 3.9 and earlier due to the If this proposed transition is acceptable, I'd be tempted to wrap the offending call in a compatibility wrapper (something that would signal its removal after Python 3.9 support is dropped), but I'm not sure it's worth the effort. |
3acbaf3 to
e5c6df7
Compare
|
The coverage failure doesn't make any sense: Does |
01dc868 to
cb8076b
Compare
cb8076b to
163c42d
Compare
adiroiban
left a comment
There was a problem hiding this comment.
Thanks. Happy to use pathlib.
I left a few minor comments.
I don't line universal newlines.
On my projects, we always use \n for the source code.
You don't want a source file created on Windows to conflict with Linux.
So I think towncrier should just auto-detect the newlines used in the "filename" configuration and use that for "create" and other cases.
|
Thanks. If you are happy with this PR, feel free to merge. |
|
Sorry. My bad. I set the wrong permissiosn for the team. I have merged it, but in the future you should be able to merge. Thanks again! |

Description
While working on #577, I noticed it might be nice to leverage pathlib for reading and writing files. This approach avoids adding nesting and with blocks by utilizing
read_textandwrite_text.This PR depends on #577 and should be rebased after merging that one.
Checklist
src/towncrier/newsfragments/. Describe yourchange and include important information. Your change will be included in the public release notes.
docs/tutorial.rstis still up-to-date.docs/cli.rstreflects those changes.docs/configuration.rstreflects those changes.