Skip to content

Commit 0b6d0a5

Browse files
committed
attempted to build documentation by sphinx into github.io
1 parent ecbcf51 commit 0b6d0a5

File tree

8 files changed

+207
-0
lines changed

8 files changed

+207
-0
lines changed

.github/workflows/sphinx.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: "Sphinx: Render docs"
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
contents: write
10+
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
persist-credentials: false
14+
- name: Build HTML
15+
uses: ammaraskar/sphinx-action@master
16+
- name: Upload artifacts
17+
uses: actions/upload-artifact@v4
18+
with:
19+
name: html-docs
20+
path: docs/build/html/
21+
- name: Deploy
22+
uses: peaceiris/actions-gh-pages@v3
23+
if: github.ref == 'refs/heads/main'
24+
with:
25+
github_token: ${{ secrets.GITHUB_TOKEN }}
26+
publish_dir: docs/build/html

docs/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)

docs/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+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
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

docs/source/api.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
API
2+
===
3+
4+
.. autosummary::
5+
:toctree: generated
6+
7+
py_utils.utils_segmentation

docs/source/conf.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
# -- Project information -----------------------------------------------------
7+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8+
9+
project = "py_utils"
10+
copyright = "2025, Chad Lin"
11+
author = "Chad Lin"
12+
release = "0.1.0"
13+
14+
# -- General configuration ---------------------------------------------------
15+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
16+
17+
extensions = [
18+
"sphinx.ext.duration",
19+
"sphinx.ext.autodoc",
20+
"sphinx.ext.doctest",
21+
"sphinx.ext.autosummary",
22+
"sphinx.ext.napoleon",
23+
]
24+
25+
templates_path = ["_templates"]
26+
exclude_patterns = []
27+
28+
29+
# -- Options for HTML output -------------------------------------------------
30+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
31+
32+
# html_theme = "alabaster"
33+
# html_theme = "python_docs_theme"
34+
html_theme = "haiku"
35+
html_static_path = ["_static"]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
py\_utils.utils\_segmentation
2+
=============================
3+
4+
.. automodule:: py_utils.utils_segmentation
5+
6+
7+
.. rubric:: Functions
8+
9+
.. autosummary::
10+
11+
compute_sliding_window_indices
12+
compute_sliding_window_indices_with_overlap
13+
segmented_argmax
14+
segmented_argmin
15+
segmented_count
16+
segmented_max
17+
segmented_mean
18+
segmented_min
19+
segmented_sum
20+
segmented_where
21+
sliding_window
22+

docs/source/index.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.. py_utils documentation master file, created by
2+
sphinx-quickstart on Tue Nov 11 10:15:30 2025.
3+
You can adapt this file completely to your liking, but it should at least
4+
contain the root `toctree` directive.
5+
6+
py_utils Documentation
7+
======================
8+
9+
Add your content using ``reStructuredText`` syntax. See the
10+
`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_
11+
documentation for details.
12+
13+
Check out the :doc:`usage` section for further information, including how to
14+
:ref:`install <installation>` the project.
15+
16+
.. note::
17+
This project is under active development. Documentation may change frequently.
18+
19+
.. toctree::
20+
:maxdepth: 2
21+
:caption: Contents:
22+
23+
usage
24+
api

docs/source/usage.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Usage
2+
=====
3+
4+
.. _installation:
5+
6+
Installation
7+
------------
8+
9+
To use the `python_utils` package, you first need to install it. You can do this using pip:
10+
11+
12+
.. code-block:: console
13+
14+
$ git clone https://github.com/ChadLin9596/python_utils.git
15+
16+
either
17+
$ pip install ./python_utils
18+
or
19+
$ pip install -e ./python_utils
20+
21+
22+
Creating recipes
23+
----------------
24+
25+
To retrieve a list of random ingredients,
26+
you can use the ``lumache.get_random_ingredients()`` function:
27+
28+
.. py:function:: lumache.get_random_ingredients(kind=None)
29+
30+
Return a list of random ingredients as strings.
31+
32+
:param kind: Optional "kind" of ingredients.
33+
:type kind: list[str] or None
34+
:return: The ingredients list.
35+
:rtype: list[str]
36+
37+
38+
.. autofunction:: py_utils.utils_segmentation.segmented_sum

0 commit comments

Comments
 (0)