-
Notifications
You must be signed in to change notification settings - Fork 418
Auto-generated API docs with sphinx #2049
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
base: main
Are you sure you want to change the base?
Conversation
shralex
left a comment
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 Samuel! Added a few comments. Can we please close this space https://github.com/maxtext and replace references to it from the PR description to the reads-the-docs website.
bvandermoon
left a comment
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.
For my understanding, where do these generated API docs end up? Do we run this manually? Or will it automatically be uploaded to ReadTheDocs?
@MarcoGorelli Thanks for following up. I plan on taking the codebase and going module by module "Gemini: add missing file, module, class, and function docstrings in Google docstring format". Alternatively others can do the same. It should be trivial to maintain 100% doc coverage for this codebase. As for the specific issues you are coming across, I'll try and replicate. Sometimes sphinx rst's format needs to be explicitly overriden in favour of Google's docstring format; which may be the cause of the issue.
@bvandermoon Thanks for following up. The documentation is auto generated onto readthedocs. |
Sure, if it was expected that with this PR then the listed members wouldn't show up, then no objections Other than that, there's some commented-out code that's being added here, is that intended? |
pyproject.toml
Outdated
| #[tool.hatch.metadata.hooks.requirements_txt] | ||
| #files = ["requirements.txt"] |
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.
is it intentional to have added this commented-out code?
838b576 to
13c45bd
Compare
| def setup(app): | ||
| run_apidoc(None) | ||
| print("running:", app) | ||
| # app.connect("builder-inited", run_apidoc) |
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.
should this be un-commented or deleted?
| def setup(app): | ||
| run_apidoc(None) | ||
| print("running:", app) | ||
| # app.connect("builder-inited", run_apidoc) |
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.
hi @SamuelMarks
sorry, it's still not clear to me why we're adding this commented-out line
# app.connect("builder-inited", run_apidoc)
is it meant to be uncommented under certain circumstances?
| pip install -e . --no-dependencies | ||
| pip install torch |
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.
Why are these dependencies needed for building 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.
Because torch is imported somewhere in the codebase and sphinx raises a warning about this
| # for import docs | ||
| -r base_requirements/requirements.txt | ||
| google-tunix>=0.1.1 | ||
| mlcommons-loadgen | ||
| mlperf-logging @ https://github.com/mlcommons/logging/archive/38ab22670527888c8eb7825a4ece176fcc36a95d.zip | ||
| tf-keras | ||
| torch==2.7.1 | ||
| trl==0.19.0 | ||
| vllm |
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.
Why are these needed for docs?
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.
Because these are each imported somewhere in the codebase and sphinx raises a warning about this
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.
Shouldn't this just be dependencies that are required for the documents themselves? Seems that is how @melissawm set it up previously. If it's just a warning, can we leave it off/turn it off? Or is the recommended approach to actually require the full MaxText set of dependencies?
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.
It gives nice highlighting and documentation hints that would be missed if these were not installed (also the build fails)
5be41e6 to
4358e11
Compare
…p ; [docs/reference/api.rst] Placeholder for generated API docs ; [pyproject.toml] Uncomment docs deps ; [docs/guides.md] Remove redundant extensions ; [src/MaxText/inference_mlperf/offline_mode.py] Switch from `flags` to `argparse` to overcome duplicate flag error; [.github/workflows/check_docs_build.yml] Use `uv` to resolve max recursive dependency resolution issue ; [src/MaxText/inference_mlperf/matmul/matmul_dtypes.py] Hide under `if __name__ == "__main__"` to resolve hangups on TPUs and CPUs

This PR adds generated API docs.
Checklist
Before submitting this PR, please make sure (put X in square brackets):