#281 Build documentation by sphinx
Merged by cqi. Opened by cqi.
cqi/rpkg build-doc  into  master

Download 281.patch

As a startup, this PR contains basic documentation structure and API documentation can be generated from existing docstrings.

Another change is the manpages generation which is rewritten totally. Now, man pages are generated by sphinx from each command's RST document that is constructed from registered CLI commands in cli.py. As rpkg has example a CLI implementation that is not distributed, a sample name sample-rpkg is used in final rendered HTML and man pages. Downstream client tool built on top of rpkg can reuse the script generate_man_pages.py technically.

In the future, documentation needs to be maintained and add more content step by step. We have to write docstrings and help text in register_* methods much carefully in order to provide good documentation.

An example generated documentation site is here https://cqi.fedorapeople.org/rpkg-doc-demo/html/

Fixes #50

Nice!

The HTML documentation looks very useful.

A couple comments for the man pages:

  • there is no page for sample-rpkg itself. Will this be maintained manually?
  • at first I was confused that the header and Name section use a dash between command and subcommand (e.g. sample-rpkg-build). However the synopsis shows it correctly as a subcommand. This is not really an issue, man git-clone shows the exact same thing.

A further improvement might be better handling of aliases. Duplicating the same man page for ci and commit makes little sense to me, it would be nicer to have ci redirect users to documentation of commit. Currently only man page mentions the alias, HTML version does not have this info.

On Fri, 2018-01-05 at 10:29 +0000, Lubomír Sedlář wrote:

lsedlar commented on the pull-request: Build documentation by sphinx that you are following:
``
Nice!

The HTML documentation looks very useful.

A couple comments for the man pages:

  • there is no page for sample-rpkg itself. Will this be maintained
    manually?

This should be handled automatically as much as possible. I didn't add
it because I thought rpkg now does not deliver an executable command
named rpkg (to avoid potential confusion if rpkg-client wants to
generate documents as well).

But, seems it would be useful to generate a page for sample-rpkg and
it could also be reused by downstream client tools, e.g. fedpkg, to
generate such a page for themselves.

Keep this PR opening. I'll fix this in another commit and push to this
PR.

  • at first I was confused that the header and Name section use a
    dash between command and subcommand (e.g. sample-rpkg-build).
    However the synopsis shows it correctly as a subcommand. This is not
    really an issue, man git-clone shows the exact same thing.

A further improvement might be better handling of aliases.
Duplicating the same man page for ci and commit makes little
sense to me, it would be nicer to have ci redirect users to
documentation of commit. Currently only man page mentions the
alias, HTML version does not have this info.
``

Yeah, make sense to me as well to handle the alias particularly. I'll
file an issue for this point.

Thanks for your review. :)

rebased onto af7f9d2182c727f1b744da049dde857127a27b05

Rebased and fixed conflicts. Both HTML document and manpage are generated for sample-rpkg now.

6 new commits added

  • Rename generate_man_pages.py
  • Generate HTML document and manpage for sample rpkg
  • Simplify doc Makefile
  • Generate commands HTML and man pages
  • Update existing docstrings
  • Generate documents by sphinx

Updated demo docs:

HTML: https://cqi.fedorapeople.org/rpkg-demo-docs/html/
manpages: https://cqi.fedorapeople.org/rpkg-demo-docs/man/

1 new commit added

  • Fix MANIFEST.in to list files for building doc

Ready for review again.

rebased onto 27d96e87fd7d4e8d9ffe03ac69d67ea11a073981

rebased onto c6aa039e5d0c721a7df109ca0daa06775e36d0f0

1 new commit added

  • Run document generator script in Py3 explictly

Patch is rebased and updated with some minor changes in order to work with latest code. In addition, sample-rpkg.rst is removed from source/commands/ directory as there is already cli.rst generated.

I'm back to this patch and going to merge it, because some subcommands have been added to rpkg in the past and there will be more and existing commands will be enhanced, e.g. to support build from stream branches. By merging this patch, it is possible to provide a good documentation to users and easy for us to write release notes for future versions than the simple plain text file CHANGELOG.rst.

CHANGELOG.rst will not be removed IMO, it could be there to include a simple list of changes, but release notes in doc/ could provide more info and details, e.g. deprecations.

Do you plan to build the documentation as part of RPM build? Using python3 could be an issue then.

When I try to create the documentation in a fresh clone, I'm getting an error:

$ LANG=C make html
rm: cannot remove 'source/cli.rst': No such file or directory
make: *** [Makefile:16: clean-files] Error 1

The output that you linked looks good to me.

Undefined name templates.

This redefines the parser argument. Is that really correct?

1 new commit added

  • Fix mistakes during rebase

Pretty please pagure-ci rebuild

Do you plan to build the documentation as part of RPM build? Using python3 could be an issue then.

For current stage, we could just push documentation to docs.pagure.org/rpkg.

I'm not sure if it makes sense to packagers to ship docs within RPM. If it does and someone wants it, then we can do that, and I thought it probably could be built only for and since f29.

I'm not sure if it makes sense to packagers to ship docs within RPM. If it does and someone wants it, then we can do that, and I thought it probably could be built only for and since f29.

It would probably work for all Fedoras, they all have Python 3. I was concerned about internal builds, but I agree that they really don't need the documentation.

1 new commit added

  • Minor fixes to doc build

@lsedlar both of the issues are fixed.

@lsedlar any comment to this PR?

Nothing else. Looks good to me. :100:

Commit 38727bba fixes this pull-request

Pull-Request has been merged by cqi

Pull-Request has been merged by cqi

Metadata