Skip to content

SphinxDocs set up #572

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

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
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
Binary file added .DS_Store
Binary file not shown.
Binary file added .github/.DS_Store
Binary file not shown.
57 changes: 57 additions & 0 deletions .github/workflows/doc_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Docs

on:
push:
branches:
- main
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
architecture: x64
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Dependencies
run: |

set -eux
pip install --upgrade pip
pip install -r build-requirements.txt
pip install --no-build-isolation .

pip install -r docs/requirements.txt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to install requirements.txt from the root of the repo.
and then build monarch from source: pip install --no-build-isolation .


- name: Build Sphinx Docs
working-directory: docs
run: |
set -eux

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
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,14 @@ Cargo.lock
# mdbook output
books/hyperactor-book/book/**

# macOS files
.DS_Store
docs/source/.DS_Store

# Sphinx build files
build/**
docs/_build/**
docs/build/**
docs/generated/**

CLAUDE.md
9 changes: 8 additions & 1 deletion books/hyperactor-book/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# hyperactor Documentation Book
# Hyperactor Documentation Book

This is the development documentation for the hyperactor system, built using [`mdBook`](https://rust-lang.github.io/mdBook/).

```{toctree}
:maxdepth: 2
:caption: Contents

./src/introduction
```

## Running the Book

### On the **Server**
Expand Down
11 changes: 11 additions & 0 deletions books/hyperactor-book/src/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,14 @@ This book describes the design and implementation of the hyperactor runtime.
The goal is to provide a clear, structured explanation of how actors communicate safely and efficiently across distributed systems using hyperactor’s abstractions.

We hope this becomes the book we wish we had when we started working with Monarch. Work in progress.

```{toctree}
:maxdepth: 2
:caption: Contents

refrences
mailbox
macros
actors
summary
```
Binary file added docs/.DS_Store
Binary file not shown.
35 changes: 35 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

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

# Generate example documentation from Python files
generate-examples:
@echo "Generating example documentation..."
@cd "$(SOURCEDIR)" && python GenerateExamples.py

# Override html target to run generate-examples first and include books
html:
@echo "Building HTML documentation with books directory..."
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile html

# 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)

clean:
@echo "Cleaning up build directory..."
@rm -rf "$(BUILDDIR)"
@rm -rf "$(SOURCEDIR)/generated"
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
13 changes: 13 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
sphinx==7.2.6
-e git+https://github.com/pytorch/pytorch_sphinx_theme.git@pytorch_sphinx_theme2#egg=pytorch_sphinx_theme2
sphinxcontrib.katex==0.9.10
#breathe==4.34.0 # only if generating C++
exhale==0.2.3 # only if generating C++ docs
docutils>=0.18.1,<0.21
sphinx-design==0.6.1
sphinxcontrib-mermaid==1.0.0
myst-parser #==0.18.1 # if want to contribute in markdown
sphinx-gallery==0.14.0 # only if hosting interactive tutorials
sphinx-sitemap==2.7.1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add sphinx-rust== figure out the version

sphinxext-opengraph
nbsphinx
Binary file added docs/source/.DS_Store
Binary file not shown.
16 changes: 16 additions & 0 deletions docs/source/books/books.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Books

This section contains books and comprehensive guides for Monarch.

```{toctree}
:maxdepth: 2
:caption: Available Books
:hidden:

./hyperactor-book/src/introduction
```


## [HyperActor Book](./hyperactor-book/src/introduction)

The HyperActor Book provides a comprehensive guide to using the actor system in Monarch.
1 change: 1 addition & 0 deletions docs/source/books/hyperactor-book/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
book/
75 changes: 75 additions & 0 deletions docs/source/books/hyperactor-book/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Hyperactor Documentation Book

This is the development documentation for the hyperactor system, built using [`mdBook`](https://rust-lang.github.io/mdBook/).

```{toctree}
:maxdepth: 2
:caption: Contents

./src/introduction
./src/refrences
mailbox
macros
actors
summary
```

## Running the Book

### On the **Server**

To run the book on a remote server (e.g., `devgpu004`):

```bash
x2ssh devgpu004.rva5.facebook.com
tmux new -s mdbook
cd ~/fbsource/fbcode/monarch/books/hyperactor-book
mdbook serve
```
Then detach with Ctrl+b, then d.

### On the **Client**

To access the remote book from your local browser:
```bash
autossh -M 0 -N -L 3000:localhost:3000 devgpu004.rva5.facebook.com
```
Then open http://localhost:3000 in your browser.

**Note**: If you don’t have autossh installed, you can install it with:
```bash
brew install autossh
```

### Notes

- The source is located in src/, with structure defined in SUMMARY.md.
- The book will auto-reload in the browser on edits.

## Cleaning Up

To shut down the book server:

### Option 1: Reattach and stop

```bash
x2ssh devgpu004.rva5.facebook.com
tmux attach -t mdbook
```
Inside the session:
- Press Ctrl+C to stop mdbook serve
- Then type exit to close the shell and terminate the tmux session

### Option 2: Kill the session directly

If you don’t want to reattach, you can kill the session from a new shell:
```bash
x2ssh devgpu004.rva5.facebook.com
tmux kill-session -t mdbook
```

### Optional: View active tmux sessions
```bash
tmux ls
```
Use this to check whether the mdbook session is still running.
9 changes: 9 additions & 0 deletions docs/source/books/hyperactor-book/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[book]
authors = ["Shayne Fletcher"]
language = "en"
src = "src"
title = "Hyperactor Book"

[output.html]
git-repository-url = "https://github.com/pytorch-labs/monarch"
edit-url-template = "https://github.com/pytorch-labs/monarch/edit/main/books/hyperactor-book/src/{path}"
39 changes: 39 additions & 0 deletions docs/source/books/hyperactor-book/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Summary

- [Introduction](./introduction.md)
- [References](references/index.md)
- [Syntax](references/syntax.md)
- [WorldId](references/world_id.md)
- [ProcId](references/proc_id.md)
- [ActorId](references/actor_id.md)
- [PortId](references/port_id.md)
- [GangId](references/gang_id.md)
- [Reference](references/reference.md)
- [Typed References](references/typed_refs.md)
- [Mailboxes and Routers](mailboxes/index.md)
- [Ports](mailboxes/ports.md)
- [MailboxSender](mailboxes/mailbox_sender.md)
- [Reconfigurable Senders](mailboxes/reconfigurable_sender.md)
- [MailboxServer](mailboxes/mailbox_server.md)
- [MailboxClient](mailboxes/mailbox_client.md)
- [Mailbox](mailboxes/mailbox.md)
- [Delivery Semantics](mailboxes/delivery.md)
- [Multiplexers](mailboxes/multiplexer.md)
- [Routers](mailboxes/routers.md)
- [Actors](actors/index.md)
- [Actor](actors/actor.md)
- [Handler](actors/handler.md)
- [RemoteableActor](actors/remotable_actor.md)
- [Checkpointable](actors/checkpointable.md)
- [RemoteActor](actors/remote_actor.md)
- [Binds](actors/binds.md)
- [RemoteHandles](actors/remote_handles.md)
- [ActorHandle](actors/actor_handle.md)
- [Actor Lifecycle](actors/actor_lifecycle.md)
- [Macros](macros/index.md)
- [`#[derive(Handler)]`](macros/handler.md)
- [`#[derive(HandleClient)]`](macros/handle_client.md)
- [`#[derive(RefClient)]`](macros/ref_client.md)
- [`#[derive(Named)]`](macros/named.md)
- [`#[export]`](macros/export.md)
- [`#[forward]`](macros/forward.md)
Loading