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

Merged
merged 12 commits into from
May 29, 2024
Merged

Docs #64

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
23 changes: 12 additions & 11 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,20 @@ RUN rm -rf /var/lib/apt/lists/* && \

# System-wide python packages
RUN python -m pip install --upgrade pip setuptools pytest && \
python -m pip install black \
python -m pip install \
black \
ipykernel \
kaleido \
lightning>=2.1.0 \
matplotlib \
kaleido>=0.2 \
lightning>=2.1.9 \
matplotlib>=3.7 \
nbformat \
numpy \
pandas \
plotly \
seaborn \
scipy \
torchmetrics \
torchvision
numpy>=1.22 \
pandas>=2.0 \
plotly>=5.18 \
seaborn>=0.11 \
scipy>=1.10 \
torchmetrics>=1.3.0 \
torchvision>=0.15


# Change shell for user b
Expand Down
12 changes: 4 additions & 8 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"build": {
"dockerfile": "Dockerfile"
},
"postStartCommand": ".devcontainer/post_start.sh",
"containerUser": "vscode",

"runArgs": [
"--gpus",
"all",
Expand All @@ -14,21 +17,14 @@
"--ulimit",
"stack=67108864"
],
"postStartCommand": ".devcontainer/post_start.sh",
"containerUser": "vscode",
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.black-formatter",
"ms-toolsai.jupyter",
"ms-toolsai.vscode-jupyter-powertoys",
"github.copilot",
"donjayamanne.git-extension-pack",
"akamud.vscode-theme-onedark",
"njpwerner.autodocstring",
"grapecity.gc-excelviewer",
"yzhang.markdown-all-in-one"
"donjayamanne.git-extension-pack"
]
}
}
Expand Down
9 changes: 2 additions & 7 deletions .devcontainer/post_start.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#!/bin/bash

echo "Installing minerva"
echo "Installing minerva (editable mode)..."
pip install -e .

# Add tmux options
echo -e "set -g default-terminal \"screen-256color\"\nset -g mouse on\nbind e setw synchronize-panes on\nbind E setw synchronize-panes off" >> ~/.tmux.conf

# remove full path from prompt
sed -i '/^\s*PS1.*\\w/s/\\w/\\W/g' ~/.bashrc
echo "Minerva installed in editable mode"
42 changes: 42 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: minerva documentation
on:
push:
branches:
- docs

jobs:
docs:
name: Minverva documentation
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v2

- name: Install Python
uses: actions/setup-python@v1
with:
python-version: 3.11.9

- name: Install packages
run: |
sudo apt-get update
sudo apt-get install -y pandoc

- name: Install requirements
run: |
pip3 install sphinx sphinx-rtd-theme sphinx-autodoc-typehints sphinx-argparse sphinx-autoapi nbsphinx pandoc Ipython

- name: Build docs
run: |
cd docs
make clean
make html

# https://github.com/peaceiris/actions-gh-pages
- name: Deploy
if: success()
uses: peaceiris/actions-gh-pages@v3
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/build/html/
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,6 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
experiments/
logs/
lightning_logs/
File renamed without changes.
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 = .
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)
8 changes: 8 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Programming Reference
-----------------------

Here is the Programming Interface

.. toctree::

autoapi/minerva/index
4 changes: 4 additions & 0 deletions docs/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

# make clean
make html
101 changes: 101 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
import sys
import os
sys.path.insert(0, os.path.abspath('../'))

import sphinx_rtd_theme

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))


# -- Project information -----------------------------------------------------

project = 'minerva'
copyright = '2024, Unicamp'
author = 'Discovery'

source_suffix = ['.rst']
master_doc = 'index'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = [
'**.ipynb_checkpoints',
"**ipynb_checkpoints"
]


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'autoapi.extension',
'sphinx_rtd_theme',
'sphinx.ext.viewcode',
'sphinx.ext.autodoc.typehints',
'sphinx.ext.mathjax',
"nbsphinx",
"IPython.sphinxext.ipython_console_highlighting"
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['build', 'Thumbs.db', '.DS_Store', '.git']

####### Auto API
autoapi_type = 'python'
autoapi_dirs = ['../minerva/']
autoapi_member_order = 'alphabetical'
autoapi_python_use_implicit_namespaces = True
autoapi_python_class_content = 'both'
autoapi_file_patterns = ['*.py']
autoapi_generate_api_docs = True
autoapi_add_toctree_entry = False
# source_suffix = '.rst'
autodoc_typehints = 'description'

######## NBSPHINX
nbsphinx_execute = 'never'
nbsphinx_allow_errors = True
nbsphinx_codecell_lexer = 'python3'
nbsphinx_execute_arguments = [
"--InlineBackend.figure_formats={'svg', 'pdf'}",
"--InlineBackend.rc={'figure.dpi': 96}",
]



# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
htmlhelp_basename = 'minerva_docs'
htmlhelp_basename = 'minerva_docs'
source_encoding = 'utf-8'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
4 changes: 4 additions & 0 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Contributing
------------

Under construction...
23 changes: 23 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.. SSLTools documentation master file, created by
sphinx-quickstart on Mon Jan 29 18:33:36 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Welcome to Minerva's documentation!
====================================

.. toctree::
:maxdepth: 2
:caption: Contents:

installation
tutorials
api


Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
15 changes: 15 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.. _installation:

==========================
Installation Guide
==========================

Pip Installation
---------------------

To install Minerva, you can use pip:

.. code-block:: bash

pip install minerva

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=.
set BUILDDIR=build

if "%1" == "" goto help

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

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

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

:end
popd
7 changes: 7 additions & 0 deletions docs/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
minerva
=========

.. toctree::
:maxdepth: 4

minerva
Loading
Loading