Skip to content

Commit e8cce40

Browse files
committed
some docs
1 parent e4afdd7 commit e8cce40

File tree

8 files changed

+280
-3
lines changed

8 files changed

+280
-3
lines changed

.github/workflows/sphinx.yml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# From: https://github.com/rkdarst/sphinx-actions-test/blob/master/.github/workflows/sphinx-build.yml
2+
3+
name: sphinx
4+
on: [push, pull_request]
5+
6+
env:
7+
DEFAULT_BRANCH: "master"
8+
#SPHINXOPTS: "-W --keep-going -T"
9+
# ^-- If these SPHINXOPTS are enabled, then be strict about the builds and fail on any warnings
10+
11+
jobs:
12+
build-and-deploy:
13+
name: Build and gh-pages
14+
runs-on: ubuntu-latest
15+
steps:
16+
# https://github.com/marketplace/actions/checkout
17+
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
lfs: true
21+
# https://github.com/marketplace/actions/setup-python
22+
# ^-- This gives info on matrix testing.
23+
- name: Install Python
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: 3.8
27+
# https://docs.github.com/en/actions/guides/building-and-testing-python#caching-dependencies
28+
# ^-- How to set up caching for pip on Ubuntu
29+
- name: Cache pip
30+
uses: actions/cache@v2
31+
with:
32+
path: ~/.cache/pip
33+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
34+
restore-keys: |
35+
${{ runner.os }}-pip-
36+
${{ runner.os }}-
37+
# https://docs.github.com/en/actions/guides/building-and-testing-python#installing-dependencies
38+
# ^-- This gives info on installing dependencies with pip
39+
- name: Install dependencies
40+
run: |
41+
python -m pip install --upgrade pip
42+
pip install -r requirements.txt
43+
- name: Debugging information
44+
run: |
45+
echo "github.ref:" ${{github.ref}}
46+
echo "github.event_name:" ${{github.event_name}}
47+
echo "github.head_ref:" ${{github.head_ref}}
48+
echo "github.base_ref:" ${{github.base_ref}}
49+
set -x
50+
git rev-parse --abbrev-ref HEAD
51+
git branch
52+
git branch -a
53+
git remote -v
54+
python -V
55+
pip list --not-required
56+
pip list
57+
# Build
58+
- uses: ammaraskar/sphinx-problem-matcher@master
59+
- name: Build Sphinx docs
60+
run: |
61+
make dirhtml
62+
# This fixes broken copy button icons, as explained in
63+
# https://github.com/coderefinery/sphinx-lesson/issues/50
64+
# https://github.com/executablebooks/sphinx-copybutton/issues/110
65+
# This can be removed once these PRs are accepted (but the
66+
# fixes also need to propagate to other themes):
67+
# https://github.com/sphinx-doc/sphinx/pull/8524
68+
# https://github.com/readthedocs/sphinx_rtd_theme/pull/1025
69+
sed -i 's/url_root="#"/url_root=""/' _build/dirhtml/index.html || true
70+
# The following supports building all branches and combining on
71+
# gh-pages
72+
73+
# Clone and set up the old gh-pages branch
74+
- name: Clone old gh-pages
75+
if: ${{ github.event_name == 'push' }}
76+
run: |
77+
set -x
78+
git fetch
79+
( git branch gh-pages remotes/origin/gh-pages && git clone . --branch=gh-pages _gh-pages/ ) || mkdir _gh-pages
80+
rm -rf _gh-pages/.git/
81+
mkdir -p _gh-pages/branch/
82+
# If a push and default branch, copy build to _gh-pages/ as the "main"
83+
# deployment.
84+
- name: Copy new build (default branch)
85+
if: |
86+
contains(github.event_name, 'push') &&
87+
contains(github.ref, env.DEFAULT_BRANCH)
88+
run: |
89+
set -x
90+
# Delete everything under _gh-pages/ that is from the
91+
# primary branch deployment. Eicludes the other branches
92+
# _gh-pages/branch-* paths, and not including
93+
# _gh-pages itself.
94+
find _gh-pages/ -mindepth 1 ! -path '_gh-pages/branch*' -delete
95+
rsync -a _build/dirhtml/ _gh-pages/
96+
# If a push and not on default branch, then copy the build to
97+
# _gh-pages/branch/$brname (transforming '/' into '--')
98+
- name: Copy new build (branch)
99+
if: |
100+
contains(github.event_name, 'push') &&
101+
!contains(github.ref, env.DEFAULT_BRANCH)
102+
run: |
103+
set -x
104+
#brname=$(git rev-parse --abbrev-ref HEAD)
105+
brname="${{github.ref}}"
106+
brname="${brname##refs/heads/}"
107+
brdir=${brname//\//--} # replace '/' with '--'
108+
rm -rf _gh-pages/branch/${brdir}
109+
rsync -a _build/dirhtml/ _gh-pages/branch/${brdir}
110+
# Go through each branch in _gh-pages/branch/, if it's not a
111+
# ref, then delete it.
112+
- name: Delete old feature branches
113+
if: ${{ github.event_name == 'push' }}
114+
run: |
115+
set -x
116+
for brdir in `ls _gh-pages/branch/` ; do
117+
brname=${brdir//--/\/} # replace '--' with '/'
118+
if ! git show-ref remotes/origin/$brname ; then
119+
echo "Removing $brdir"
120+
rm -r _gh-pages/branch/$brdir/
121+
fi
122+
done
123+
# Add the .nojekyll file
124+
- name: nojekyll
125+
if: ${{ github.event_name == 'push' }}
126+
run: |
127+
touch _gh-pages/.nojekyll
128+
# Deploy
129+
# https://github.com/peaceiris/actions-gh-pages
130+
- name: Deploy
131+
uses: peaceiris/actions-gh-pages@v3
132+
if: ${{ github.event_name == 'push' }}
133+
#if: ${{ success() && github.event_name == 'push' && github.ref == 'refs/heads/$defaultBranch' }}
134+
with:
135+
publish_branch: gh-pages
136+
github_token: ${{ secrets.GITHUB_TOKEN }}
137+
publish_dir: _gh-pages/
138+
force_orphan: true

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = source
9+
BUILDDIR = build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
![Logo](images/stochman.png)
22
---
33

4-
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pytorch-lightning)](https://pypi.org/project/stochman/)
4+
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/stochman)](https://pypi.org/project/stochman/)
55
[![PyPI Status](https://badge.fury.io/py/stochman.svg)](https://badge.fury.io/py/stochman)
66
[![PyPI Status](https://pepy.tech/badge/stochman)](https://pepy.tech/badge/stochman)
77
[![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/MachineLearningLifeScience/stochman/blob/master/LICENSE)

docs/source/conf.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
# import os
14+
# import sys
15+
# sys.path.insert(0, os.path.abspath('.'))
16+
17+
18+
# -- Project information -----------------------------------------------------
19+
20+
project = 'stochman'
21+
copyright = '2022, Nicki'
22+
author = 'Nicki'
23+
24+
25+
# -- General configuration ---------------------------------------------------
26+
27+
# Add any Sphinx extension module names here, as strings. They can be
28+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
29+
# ones.
30+
extensions = ['sphinx.ext.autodoc']
31+
32+
# Add any paths that contain templates here, relative to this directory.
33+
templates_path = ['_templates']
34+
35+
# List of patterns, relative to source directory, that match files and
36+
# directories to ignore when looking for source files.
37+
# This pattern also affects html_static_path and html_extra_path.
38+
exclude_patterns = []
39+
40+
41+
# -- Options for HTML output -------------------------------------------------
42+
43+
# The theme to use for HTML and HTML Help pages. See the documentation for
44+
# a list of builtin themes.
45+
#
46+
html_theme = 'alabaster'
47+
48+
# Add any paths that contain custom static files (such as style sheets) here,
49+
# relative to this directory. They are copied after the builtin static files,
50+
# so a file named "default.css" will overwrite the builtin "default.css".
51+
html_static_path = ['_static']

docs/source/index.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.. stochman documentation master file, created by
2+
sphinx-quickstart on Thu Mar 17 08:27:46 2022.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
Welcome to stochman's documentation!
7+
====================================
8+
9+
WORK IN PROGRESS!
10+
11+
StochMan (Stochastic Manifolds) is a collection of elementary algorithms for computations
12+
on random manifolds learned from finite noisy data. Each algorithm assume that the considered
13+
manifold model implement a specific set of interfaces.
14+
15+
.. toctree::
16+
:maxdepth: 2
17+
:caption: Contents:
18+
19+
nnj
20+
21+
22+
23+
24+
Indices and tables
25+
==================
26+
27+
* :ref:`genindex`
28+
* :ref:`modindex`
29+
* :ref:`search`

docs/source/nnj.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
nnj
2+
***
3+
4+
.. autoclass:: stochman.nnj.Conv1d

make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=source
11+
set BUILDDIR=build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.http://sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

stochman/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
# We are not importing the rest of the package during the build process, as it may not be compiled yet
4141
else:
4242
# import modules
43-
from . import curves, discretized_manifold, geodesic, manifold, nnj
43+
from stochman import curves, discretized_manifold, geodesic, manifold, nnj
4444

4545
# import classes for direct access
46-
from .curves import CubicSpline, DiscreteCurve
46+
from stochman.curves import CubicSpline, DiscreteCurve

0 commit comments

Comments
 (0)