Issue #3657 suggests that Leo should always write black-compatible sentinel lines. Leo would no longer need the --black-sentinels command line option.
This post discusses this proposal and asks for your comments.
Background
Black adds a space between the # and @ at the start of Leo's sentinel comments, treating such comments according to the PEP8 guidelines for inline comments.
As a result, Black will continually reformat Leo's external files unless the --black-sentinels command line option was in effect when Leo wrote the external files.
The Black devs do not appear interested in treating Leo's sentinels as exceptions!
Compatibility
For at least the last several years, Leo has been able to read external files containing "blackened" comments. I know of no significant compatibility issues.
Summary
Like it or not, Black is the de-facto standard for formatting Python programs. The Ruff Format tool emulates Black's operation.
Imo, Leo should always write Black-compatible sentinels. Doing so will remove a reason for not using Leo!
Leonine projects (including Leo!) will notice large diffs when Leo converts sentinel comments to the Black-compatible format. These diffs are a one-time cost of this proposal.
Afaik, this proposal has no other negative consequences.
Your comments, please.
Edward
My main reaction is to make sure that Leo's read behavior remains backwards compatible with the pre-black sentinel format. People with much older outlines should be able to open them for the indefinite future.
It's also possible that there is some user code that does something with sentinels and assumes there will be no space after the leading '#' character. So perhaps the --black-sentinels command line option should remain in reverse: --black-sentinels=False would be allowed but not be the default .
My main reaction is to make sure that Leo's read behavior remains backwards compatible with the pre-black sentinel format.
Eleven days ago I wrote the following:
> Issue #3657 suggests that Leo should always write black-compatible sentinel lines.
> Leo would no longer need the --black-sentinels command line option.
I've changed my mind. Leo will continue to support the --black-sentinels command-line option.
This option affects only Leo's write code, but PR #3678 will improve the corresponding read code.
Aha: there is little need for blackened sentinels!
Those using Leo in an environment that mandates Black formatting are likely using @clean or @auto to avoid using sentinels.
I prefer Orange (Leo's formatter) to Black when formatting Leo's sources. Compatibility with Black is not an issue!
Summary
Few Leonistas will likely ever use the --black-sentinels command-line option, but there is no reason to remove it.
Mandating Black-compatible sentinels would be a blunder.
PR #3678 will make Leo's read code more robust.
Edward