Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add manpage #326

Closed
wants to merge 1 commit into from
Closed

Add manpage #326

wants to merge 1 commit into from

Conversation

sergiosacj
Copy link

I am closing some bugs in Debian to help add towncrier to the project.

One of them was related to the creation of a manpage. So, following Debian Developer's Reference, I am bringing it upstream because I believe it may be an useful addition.

@codecov
Copy link

codecov bot commented Mar 9, 2021

Codecov Report

Merging #326 (0bb9290) into master (4eb4b24) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #326   +/-   ##
=======================================
  Coverage   96.78%   96.78%           
=======================================
  Files          20       20           
  Lines        1183     1183           
  Branches      106      106           
=======================================
  Hits         1145     1145           
  Misses         20       20           
  Partials       18       18           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4eb4b24...0bb9290. Read the comment docs.

@adiroiban
Copy link
Member

adiroiban commented Mar 10, 2021

Thanks @sergiosacj for the man page. Much appreciated.

To me it looks a great start for towncrier documentation.
Also, it can be stored in the root while the docs structure is organized.

I guess that later it can be converted to Sphinx manpage builder to make it easier to update it and the current version is good for now.

I will leave @altendky to take the final decision as he is the current maintainer

The failed CI jobs are not related to this PR...so they can be ignored.

Thanks again!

@altendky
Copy link
Member

Thanks for the contribution. Like @adiroiban I thought (albeit briefly) about how this can be generated. My first thought was generating from the existing click --help data and I ran across https://github.com/click-contrib/click-man. But yeah, whatever form generation takes probably ought not hold up getting something useful for you added now. Maybe I can get to this later today. Sorry for the wait.

@twm
Copy link

twm commented Mar 11, 2021

This contribution appears to use a different license from Towncrier's — GPLv3 vs. MIT. Do we have a Twisted policy on this?

@altendky
Copy link
Member

Good catch. I would think that Debian could relicense as GPL. I wouldn't expect to put a GPL license into this repository though.

@sergiosacj
Copy link
Author

The reason I did it this way is because the maintainer of the Debian towncrier package has chosen to use GPLv3 in the package. As the manpage is part of the package, I did the same. I understand the trouble that this causes, will this PR be closed then?

@adiroiban
Copy link
Member

@sergiosacj would you mind submitting this PR under the MIT license?

I am not a legal expert..
I understand that MIT is not the perfect licence for documentation... but to keep things simple, I think we can use MIT for the manpage.

The way I understand GPL is that if we accept the man page under GPL, BSD distros would not be able to use it as is.

If you are the author of the work there should be no problem using the man page in Debian under GPL but send it upstream as MIT.

Thanks!

@altendky
Copy link
Member

@sergiosacj sorry, I should have used more words. I agree with @adiroiban. I did not mean to dismiss your contribution over the license. I just meant that I would expect the licenses expressed in this repository to match between the overall repo and the manpage. On the side, while it is my understanding that Debian could relicense an MIT project as GPL... it seems pretty odd and misrepresentative to do so. But, that's no matter when reviewing this PR.

On to the actual content... The first layer I see is that while the subcommands are listed, the options are presented as global rather than subcommand specific. Presently listed in the manpage:

  • --config
  • --date
  • --dir
  • -h
  • --name
  • --version
  • -v

This does not exactly agree with any subcommand, nor is it an overall comprehensive list combined together. Maybe it matches 19.9rc1 or something? It looks like git takes the same approach as click-manpage and creates a separate man page per subcommand. This does seem 'overkill' for a small project like towncrier. But, I don't know manpage style well enough to know what form a single page for multiple subcommands would take. Perhaps you can find a good example of that for a project that could be considered relevant to setting a style?

Complete actual `--help`
$ venv/bin/towncrier --help
Usage: towncrier [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  build*
  check
  create
$ venv/bin/towncrier build --help
Usage: towncrier build [OPTIONS]

Options:
  --draft         Render the news fragments, don't write to files, don't check
                  versions.

  --config TEXT   Configuration file name.
  --dir TEXT
  --name TEXT
  --version TEXT  Render the news fragments using given version.
  --date TEXT
  --yes           Do not ask for confirmation to remove news fragments.
  --help          Show this message and exit.
$ venv/bin/towncrier check --help
Usage: towncrier check [OPTIONS]

Options:
  --compare-with TEXT
  --dir TEXT
  --config TEXT
  --help               Show this message and exit.
$ venv/bin/towncrier create --help
Usage: towncrier create [OPTIONS] FILENAME

Options:
  --dir TEXT
  --config TEXT
  --edit / --no-edit  Open an editor for writing the newsfragment content.
  --help              Show this message and exit.

@sergiosacj, to make sure I understand the situation. Does getting this merged quickly or not have much effect on your work on the Debian side? What version of towncrier are you releasing? For what it's worth, I do appreciate your effort to bring this work here. I agree that the project itself ought to at least enable generation of the needed forms of documentation. manpages are pretty general so it does seem reasonable to try to provide that here. Just a matter of finding time for the work... :|

towncrier.1 Outdated Show resolved Hide resolved
@wiml
Copy link

wiml commented Mar 11, 2021

@sergiosacj My understanding is that if you are the author of the manpage, you are allowed to choose a license every time you distribute it. It's OK to give it to Debian under a GPL license and to Twisted under an MIT license. At least, that's how American copyright law works; I assume that it's the same in Brazil (since Brazil is a member of the usual international copyright conventions). Unless you have a preference for another license, I think it would be easiest for end-users if you license it under the same terms as other Towncrier code/documentation.

@altendky It's not uncommon for the manpage to simply list each subcommand invocation and its options in the SUMMARY section, e.g.: tar or have a separate COMMANDS section like kadmin or systemctl. For something simple like Towncrier, I find the tar style of manpage more accessible.

@sergiosacj
Copy link
Author

Thanks @adiroiban, @altendky and @wiml for the explanations, they helped me a lot. I will change the license as suggested.

In my understanding, the current maintainer of the package did not relicense the software, it is adding a specific license for the material produced in Debian. I agree that placing a license other than upstream only makes it difficult to submit changes and it's not a good practice, but I don't think it is misrepresentative.

On to the actual content, as I am not a towncrier user, it was very difficult to document the commands. That's why I wrote on that style. I'll try to spend more time reading the code to improve the manual. Any information about how the software works is welcome.

I'm not in a hurry, in fact, the way I wrote my first message made the wrong impression, sorry about that. My goal with this contribution is to increase the quality of the package and close some bugs, my work does not influence the existence of the package.

As I am not the maintainer of the package, I also do not make decisions. Even though I prefer to generate the manpage, it was the maintainer's preference to have the manual written in groff.

The version of towncrier that is being released is 19.2.0. As we are in the freezing period, towncrier will not be available on Debian Bullseye. At least, not for now.

@altendky
Copy link
Member

Alrighty. So you prefer a generated man page, and so do I. There's an effort over in #89 to create some Sphinx docs and @adiroiban mentioned a Sphinx-related manpage generation tool. I mentioned a Click-related manpage generation tool. I'm not sure what the appropriate path is. I also wasn't expecting to be prioritizing the documentation rework at this point as I am failing to even get a release out... and that release doesn't even include some of the original features that made me start my work here.

Anyways, @sergiosacj, are you interested in taking a look and giving a quick explanation of the relevant tools and how we might reduce repetition across Click, possible Sphinx documentation, and a manpage? Maybe we can write prose in a normal Sphinx setup and have that go into the manpage and then have brief option explanations written as-is in the Click command and option definitions but have them generated into the Sphinx output plus manpages... Seems like the sort of thing that might 'just work' but also might 'never be able to be made to work'. I dunno.

@sergiosacj
Copy link
Author

I really like your idea, but I don't think I have time to work on it. For now, I will try to improve the quality of this manpage so that it can help a more elaborated documentation in the future. If I make any promises beyond that, it is very likely that I will not be able to keep it. I'll try to start small.

@adiroiban
Copy link
Member

adiroiban commented Mar 14, 2021

Thanks for the licence update.

I think the only blocker for this PR is making sure that it documents towncrier latest dev version.

Sphinx or click man page generators should not be a blocker.

I don't see the edit/no-edit compare--with options are not in the man page.

By reading both towncrier create --help and the man page from this PR I was not able to understand what FILENAME or FRAGMENTFILE should be... I would say that``FRAGMETNAME` could be a better placeholder ... as otherwise you might thinkg that you need to pass the full path for a file.

I think that is ok to list all shared command line option only once.... but maybe in a "Shared options" paragraph.
With the current version I am not sure if the options are only for create or also for build... as --draft is listed after build.

For easy refefence. below is the --help output from master

$ pip install -U https://github.com/twisted/towncrier/archive/master.zip
$ towncrier --help
Usage: towncrier [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  build*
  check
  create

$ towncrier create --help
Usage: towncrier create [OPTIONS] FILENAME

Options:
  --dir TEXT
  --config TEXT
  --edit / --no-edit  Open an editor for writing the newsfragment content.
  --help              Show this message and exit.

$ towncrier check --help
Usage: towncrier check [OPTIONS]

Options:
  --compare-with TEXT
  --dir TEXT
  --config TEXT
  --help               Show this message and exit.

$ towncrier build --help
Usage: towncrier build [OPTIONS]

Options:
  --draft         Render the news fragments, don't write to files, don't check
                  versions.

  --config TEXT   Configuration file name.
  --dir TEXT
  --name TEXT
  --version TEXT  Render the news fragments using given version.
  --date TEXT
  --yes           Do not ask for confirmation to remove news fragments.
  --help          Show this message and exit.

It was written for the Debian GNU/Linux system but may be used by others.
@sergiosacj
Copy link
Author

@adiroiban Instead of creating a "Shared options" paragraph, I defined each option within the respective command. It allowed me to customize the descriptions, just like "--help" does. Is it okay to keep it like this?

@altendky
Copy link
Member

Adi initially deferred to me but I have since delegated back to them on this one. :] They do respond well to review requests. I'll add that now.

@bignose-debian
Copy link
Contributor

Thank you for beginning this merge request.

@sergiosacj would you mind submitting this PR under the MIT license?

That's not permitted, as Sergio does not have permission to re-license the manual page under MIT conditions. The manual page is distributed under conditions of the GPLv3-or-later license grant.

The way I understand GPL is that if we accept the man page under GPL, BSD distros would not be able to use it as is.

That's not true; BSD distributions include a lot of works that are licensed under GPLv3-or-later license grant, and many different ones also.

The Town Crier project has permission (under the GPLv3-or-later license grant) to redistribute this manual page, and all recipients have the same license grant from the copyright holder. So BSD distributions (and anyone else) has those full permissions also.

If you are the author of the work there should be no problem using the man page in Debian under GPL but send it upstream as MIT.

Fortunately, that's not permitted; the license permits changes, but those changes can be redistributed only if the GPLv3 conditions are met.

You might be thinking that the MIT license on other parts of Town Crier are relevant here? The parts of Town Crier covered by the MIT license are not linked to the manual page (and vice versa) in a way that would violate the license on either of them.

So the fact they're under different license grants is not a problem; the licenses allow any recipient to freely modify and redistribute the work, even together in the same Town Crier project or a different project.

@bignose-debian
Copy link
Contributor

bignose-debian commented Jul 16, 2022

Thanks @adiroiban, @altendky and @wiml for the explanations, they helped me a lot. I will change the license as suggested.

If the work is derived from the original, it will need to be licensed under GPLv3. I granted that license to anyone and you're free to use it under those conditions.

In my understanding, the current maintainer of the package did not relicense the software, it is adding a specific license for the material produced in Debian. I agree that placing a license other than upstream only makes it difficult to submit changes and it's not a good practice, but I don't think it is misrepresentative.

Thank you, that's accurate. Yes, it is normal for a non-trivial project to have free software under various licenses collected together. Provided they all allow recipients of the software to exercise all software freedoms needed, there should not be a problem.

One thing that is needed, of course, is to be clear what license is granted in what works; the description in the project will need to say who are the copyright holders in what parts, what exact parts are MIT-licensed, what exact parts are GPLv3-licensed, etc. and the license text needs to be in the project so recipients can get it in the same place no matter when they received the project files.

On to the actual content, as I am not a towncrier user, it was very difficult to document the commands. That's why I wrote on that style. I'll try to spend more time reading the code to improve the manual. Any information about how the software works is welcome.

I'm also happy to receive improvements and just update the original directly.

I will probably make a branch in my own repo for this, and make that available. Would that be easier?

@bignose-debian
Copy link
Contributor

I think the only blocker for this PR is making sure that it documents towncrier latest dev version.

I believe the manual page now at branch wip/issue/384/manual-page correctly documents the towncrier command as of version 21.9.1. If not, please let me know.

@adiroiban
Copy link
Member

Thanks for the feedback.

I think that instead of having a manpage in "upstream" towncrier, we should look at improving the current click usage/integration in towncrier to have --help command as helpful as possible :)

This should help with users on any OS.

There is https://github.com/click-contrib/click-man to generate the man format.


I think that is ok for distribution to create their separate manpages.


There is also an overlap / duplication between the manpages and the "official" RST base documentation.

I will use the help text from the manpage from this PR to include it into the CLI output.

Right now the CLI --help output is super brief.


The other man-page is GPL, so I will not use it so that we can keep the towncrier as MIT.


@adiroiban
Copy link
Member

so... as a first step. we should make sure that our CLI and "official" documentation have enough information to benefit all users, not only Debian or derivative distros.

Disclaimer: I am an Ubuntu user.

@adiroiban
Copy link
Member

so, the plan is to fix this via #294

That is, update the CLI help messages to be as good as the proposed man pages.

Use click-man to auto generate the man pages.

This should reduce code duplication and should help make sure the man pages are yn sync with the released version.

@adiroiban adiroiban closed this Jul 16, 2022
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.

None yet

6 participants