Skip to content

Commit

Permalink
Initialize docs (#2)
Browse files Browse the repository at this point in the history
* initialize docs

* setup sphinx and add install instructions

* add workflow to update website

* update workflow
  • Loading branch information
degleris1 authored Nov 25, 2024
1 parent ccdbf1d commit fb0642c
Show file tree
Hide file tree
Showing 9 changed files with 921 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# name: "Sphinx: Render docs"

name: documentation

on: push

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Setup Poetry
run: snok/install-poetry@v1
- name: Install Dependencies
run: poetry install --with=docs --without=experiment

- name: Sphinx build
run: poetry run sphinx-build docs/source _build

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _build/
force_orphan: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ data/
data
wandb/
wandb
build/

# Ray
.prometheus*/
Expand Down
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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)

.PHONY: help Makefile

# 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)
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
37 changes: 37 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "zap"
copyright = "2024, Anthony Degleris"
author = "Anthony Degleris"
release = "0.1.0"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
"sphinx.ext.duration",
"sphinx.ext.autodoc",
"nbsphinx",
"myst_parser",
]

source_suffix = {
".rst": "restructuredtext",
".md": "markdown",
}

templates_path = ["_templates"]
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "furo"
html_static_path = ["_static"]
27 changes: 27 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.. zap documentation master file, created by
sphinx-quickstart on Mon Nov 25 13:42:49 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
.. Add your content using ``reStructuredText`` syntax. See the
`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_
documentation for details.
zap documentation
=================

**Zap** is a Python library for for differentiable electricity system modeling.
It provides a modular, component-based approach to building electricity models.
Models can be solved using a GPU-accelerated ADMM solver, integrated into PyTorch-based deep learning models, or iteratively planned using gradient algorithms.

.. note::

This project is under active development.


.. toctree::
:hidden:
:maxdepth: 1

Home<self>
Quick Start<quickstart>
15 changes: 15 additions & 0 deletions docs/source/quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Quickstart

## Installation

We recommend using `pip` to install directly from Github.

```zsh
python3 -m pip install "zap @ git+https://github.com/degleris1/zap.git" # No PyPSA
```

Alternatively, if you want to install zap with `pypsa` support, then run the following command (instead of the above).

```zsh
python3 -m pip install "zap[pypsa] @ git+https://github.com/degleris1/zap.git" # With PyPSA
```
Loading

0 comments on commit fb0642c

Please sign in to comment.