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
generate docs when running gradio cc build
#7109
Conversation
🪼 branch checks and previews
Install Gradio from this PR pip install https://gradio-builds.s3.amazonaws.com/90822d32cc13bfd24fd7075ebbb1efb073491569/gradio-4.15.0-py3-none-any.whl Install Gradio Python Client from this PR pip install "gradio-client @ git+https://github.com/gradio-app/gradio@90822d32cc13bfd24fd7075ebbb1efb073491569#subdirectory=client/python" |
🦄 change detectedThis Pull Request includes changes to the following packages.
With the following changelog entry.
Maintainers or the PR author can modify the PR title to modify this entry.
|
graido cc build
graido cc build
gradio cc build
|
||
name = get_deep(data, ["project", "name"]) | ||
|
||
if not isinstance(name, str): | ||
raise ValueError("Name not found in pyproject.toml") | ||
|
||
pypi_exists = requests.get(f"https://pypi.org/pypi/{name}/json").status_code | ||
run_command( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would maybe skip the "Generating documentation" and just print the "Documentation generated..." but something like
Documentation generated in demo/app.py and README.md. Pass `--no-generate-docs` to disable auto documentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kinda wanted it to be not in the live panel because there isn't actually an issue with the doc gen, just a note. But I can put it at the bottom with some space.
Will update the message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! My bad, I think we should remove the backticks around --no-generate-docs since they don't change. how it renders
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @pngwn ! Just noticed two things about the CLI output.
|
||
name = get_deep(data, ["project", "name"]) | ||
|
||
if not isinstance(name, str): | ||
raise ValueError("Name not found in pyproject.toml") | ||
|
||
pypi_exists = requests.get(f"https://pypi.org/pypi/{name}/json").status_code | ||
run_command( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would maybe skip the "Generating documentation" and just print the "Documentation generated..." but something like
Documentation generated in demo/app.py and README.md. Pass `--no-generate-docs` to disable auto documentation
@freddyaboulton fixed (i think)! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @pngwn !
|
||
name = get_deep(data, ["project", "name"]) | ||
|
||
if not isinstance(name, str): | ||
raise ValueError("Name not found in pyproject.toml") | ||
|
||
pypi_exists = requests.get(f"https://pypi.org/pypi/{name}/json").status_code | ||
run_command( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! My bad, I think we should remove the backticks around --no-generate-docs since they don't change. how it renders
done! |
short_readme_path = Path(_readme_path).relative_to(_component_dir) | ||
short_demo_path = Path(_demo_path).relative_to(_component_dir) | ||
live.update( | ||
f":white_check_mark: Documention generated in [orange3]{short_demo_path}[/] and [orange3]{short_readme_path}[/]. Pass --no-generate-docs to disable auto documentation." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
I've also tweaked the |
Description
Runs the docs generator as part of the build. This only provides defaults with no options (so as not to bloat the build command). If you users wish to customise the behaviour, they can use the
docs
command.Added new arg to
build
to optionally disbale the docs gen:Related to #7080.
Please include a concise summary, in clear English, of the changes in this pull request. If it closes an issue, please mention it here.
Closes: #(issue)
🎯 PRs Should Target Issues
Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.
Not adhering to this guideline will result in the PR being closed.
Tests
PRs will only be merged if tests pass on CI. To run the tests locally, please set up your Gradio environment locally and run the tests:
bash scripts/run_all_tests.sh
You may need to run the linters:
bash scripts/format_backend.sh
andbash scripts/format_frontend.sh