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

[FEATURE] Sphinx plugin #100

Closed
rgreinho opened this issue May 10, 2020 · 7 comments
Closed

[FEATURE] Sphinx plugin #100

rgreinho opened this issue May 10, 2020 · 7 comments
Labels
answered feature New feature, enhancement or request

Comments

@rgreinho
Copy link

Is your feature request related to a problem

I want to be able to integrate the generation of the CLI documentation to the documentation I build with Sphinx.

The solution you would like

A sphinx plugin seems like the perfect candidate. Something like sphinx-click.

Describe alternatives you've considered

The workaround I am using is to modify the Makefile provided by Sphinx to generate the Typer documentation with typer-cli:

DETAILED_USAGE_PAGE = source/usage.md

%: Makefile
    echo "# Detailed usage" > "$(DETAILED_USAGE_PAGE)"
    typer $(shell git rev-parse --show-toplevel)/tfpy/main.py utils docs --name tfpy | tail -n +2 >> "$(DETAILED_USAGE_PAGE)"
    @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

Here is the actual file.

Additional context

Here is the project I am using Typer with: tfpy. And its documentation.

@rgreinho rgreinho added the feature New feature, enhancement or request label May 10, 2020
@tiangolo
Copy link
Owner

tiangolo commented Jun 6, 2020

So, this would actually be a feature request for Typer CLI not for Typer itself.

I'm personally not a fan of Sphinx and reStructuredText 😅

But maybe if supporting it is not very complex and can be done in a similar way as Markdown I would probably accept PRs there.

@rgreinho
Copy link
Author

rgreinho commented Jun 6, 2020

It does not need to be reStructuredText, markdown works just fine with Sphinx 👍

@github-actions github-actions bot removed the answered label Jun 6, 2020
@tiangolo
Copy link
Owner

tiangolo commented Jun 7, 2020

Ah, cool! Although in that case, I'm not sure I understand what would be the feature request 🤔

@rgreinho
Copy link
Author

rgreinho commented Jun 7, 2020

I was thinking of the following:

  1. It would be nice if I could avoid the workaround, where I have to discard the page title.
  2. It would be nice if simply by running the sphinx command, the documentation would be built. No need for the Makefile workaround. The behavior would be similar to sphinx-click.

@tiangolo
Copy link
Owner

tiangolo commented Jun 8, 2020

I see. Well, discarding the title page could be done in Typer CLI, I would probably take a PR with a --include-title flag that defaults to True and can be disabled if that helps.

Having it integrated with Sphinx like sphinx-click would probably require an external plugin. Or an extension to sphinx-click. I'm not sure how that would work, but it would probably work better as an external project.

@github-actions
Copy link

Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues.

@xeor
Copy link

xeor commented Feb 24, 2021

Did anyone do any work on this? I'm in the process of starting a new cli-project, and it would be very nice to have some automated docs, like sphinx-click..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered feature New feature, enhancement or request
Projects
None yet
Development

No branches or pull requests

3 participants