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

docs: add sphinx documentation and add missing documentation #18

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Docs

on:
push:
branches:
- main
pull_request:

jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: "3.10"
architecture: x64
- name: Checkout
uses: actions/checkout@v3
- name: Install Dependencies
run: |
set -eux

sudo apt-get install -y protobuf-compiler

pip install .[dev] -v

pip install -r docs/requirements.txt
- name: Build Sphinx Docs
run: |
set -eux

cd docs
make html
- name: Upload static files as artifact
id: deployment
uses: actions/upload-pages-artifact@v3
with:
path: docs/build/html/

deploy:
runs-on: ubuntu-latest
needs: build
if: ${{ github.ref == 'refs/heads/main' }}
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
8 changes: 8 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
src/pytorch-sphinx-theme
source/examples_*/
jupyter_execute/
build/

Dockerfile
my_component.py
my_app.py
36 changes: 36 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

# Minimal makefile for Sphinx documentation
# Usage:
# make html
#

# You can set these variables from the command line.
SPHINXOPTS = -W
SPHINXBUILD = sphinx-build
SPHINXPROJ = torchft
SOURCEDIR = source
BUILDDIR = build
VERSION := $(shell python -c "from importlib.metadata import version; print(version('torchft'))")

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

clean:
@echo "Deleting build directory"
rm -rf "$(BUILDDIR)"
rm -rf "$(SOURCEDIR)/examples_apps" "$(SOURCEDIR)/examples_pipelines"

.PHONY: help Makefile clean livehtml papermill

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

# optional live version
livehtml:
sphinx-autobuild --watch ../torchft --re-ignore ".*(examples_.*|.new|source/.*(Dockerfile|.py))" "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

papermill: html
./papermill.sh
8 changes: 8 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
sphinx==5.0.1
-e git+http://github.com/pytorch/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme
sphinxcontrib.katex
matplotlib
papermill
ipykernel
ipython_genutils
jinja2<=3.0.3
33 changes: 33 additions & 0 deletions docs/source/_static/img/pytorch-logo-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/_static/img/pytorch-logo-flame.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions docs/source/checkpointing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.. automodule:: torchft.checkpointing
:members:
:undoc-members:
:show-inheritance:
Loading
Loading