Skip to content

Commit

Permalink
Merge pull request #17 from ynput/15-refining-docstrings-for-code-api…
Browse files Browse the repository at this point in the history
…-enhancement

Sphinx Docs
  • Loading branch information
tweak-wtf authored Jul 19, 2024
2 parents 93b8941 + 9d8065d commit ab254f1
Show file tree
Hide file tree
Showing 30 changed files with 1,118 additions and 92 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: documentation

on:
pull_request:
branches: ["main", "develop"]

permissions:
contents: write

jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- uses: abatilo/actions-poetry@v2
- uses: conda-incubator/[email protected]
- name: Install dependencies
run: |
poetry install
- name: Install pandoc
shell: bash -el {0}
run: |
conda install pandoc
- name: Convert Readme to rst
shell: bash -el {0}
run: |
pandoc ./README.md -o ./docs/README.rst
- name: Sphinx build
run: |
poetry run sphinx-build ./docs ./docs/_build
- name: Deploy to GitHub Pages
if: github.base_ref == 'main'
uses: peaceiris/actions-gh-pages@v4
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/
force_orphan: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ results/
.python-version

test_results/
docs/_build/
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)
71 changes: 71 additions & 0 deletions docs/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
LabLib
======

Generate intermediate sequences for VFX processing using OIIO and
FFMPEG!

This module aims to help by providing helper classes and functions to: -
Get basic info from videos and images using iinfo and ffprobe as a
fallback. - Read and parse effect json outputted by
`AYON/Openpype <https://github.com/ynput>`__ for pipeline automation. -
Create a custom OCIO config file for direct use. - Create OIIO and
FFMPEG matrix values to be used in filters for repositioning. - Create
correctly formed OIIO commandline strings automatically. - Render out
frames with Color and Repositioning baked in using oiiotool

**DISCLAIMER** This is still a wip, and it’s currently missing a lot of
functionality. Use at your own risk!

Instructions
------------

The core functionality relies on using **Processors** and **Operators**
to compute the correct commandline parameters.

**Operators** are single operation classes that hold your operation
parameters (translation, luts, cdls etc.)

**Processors** (usually classes such as ``ColorTransformProcessor``)
compute **Operators** chains together. They can be fed ordered lists of
dicts (with same name attributes as Operator classes) or ordered lists
of **Operators** objects, or one at a time for secondary processing
between the chained operations. On compute they return their relevant
section of commandline flags to be passed to oiio.

**Renderers** take care of returning the fully formed commanline command
and executing it.

Installation
------------

LabLib requires ``python-3.9`` and uses ``poetry`` for managing its
dependencies.

It’s encouraged to use the provided PowerShell script to install and
download the binaries for
`oiiotool <https://www.patreon.com/posts/openimageio-oiio-63609827>`__,
`ffmpeg <https://github.com/GyanD/codexffmpeg/releases/tag/7.0.1>`__,
the `OCIO Color
Configs <https://github.com/colour-science/OpenColorIO-Configs/releases/tag/v1.2>`__
and the font `Source Code
Pro <https://fontsource.org/fonts/source-code-pro>`__ which is used in
tests.

- clone this repo
- ``.\start.ps1 install``
- ``.\start.ps1 get-dependencies``

Testing
~~~~~~~

You can run the full suite with ``.\start.ps1 test`` or to run custom
``pytest`` commands make sure to be in the cloned repository’s directory
and run ``poetry run pytest [ARGS]``.

Contributing
------------

The best way to contribute to LabLib currently is to write extensive
test cases for all modules. But also sharing your thoughts and ideas on
the `Discussions Page <https://github.com/ynput/LabLib/discussions>`__
really helps to keep this project going 💞
22 changes: 22 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import lablib

project = "LabLib"
copyright = "2024, maxpareschi, jakubjezek001, doerp"
author = lablib.__author__
release = lablib.__version__

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"sphinx.ext.napoleon",
"sphinx_copybutton",
]
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

html_theme = "furo"

todo_include_todos = True

autodoc_typehints = "none"
5 changes: 5 additions & 0 deletions docs/generators.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Generators
==========

.. automodule:: lablib.generators
:members:
15 changes: 15 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Welcome to LabLib's documentation!
==================================
.. toctree::
:maxdepth: 1

📚 README <README>
modules


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

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
5 changes: 5 additions & 0 deletions docs/lib.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Lib
===

.. automodule:: lablib.lib
:members:
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

%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/modules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
⚙️ Module Documentation
=======================

This page contains auto-generated documentation for all exposed modules.

.. toctree::
:maxdepth: 2

lib
operators
generators
processors
renderers
5 changes: 5 additions & 0 deletions docs/operators.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Operators
=========

.. automodule:: lablib.operators
:members:
5 changes: 5 additions & 0 deletions docs/processors.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Processors
==========

.. automodule:: lablib.processors
:members:
5 changes: 5 additions & 0 deletions docs/renderers.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Renderers
==========

.. automodule:: lablib.renderers
:members:
2 changes: 2 additions & 0 deletions lablib/generators/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Generator module to be used by Processors and Renderers."""

from .ocio_config import OCIOConfigFileGenerator
from .slate_html import SlateHtmlGenerator

Expand Down
Loading

0 comments on commit ab254f1

Please sign in to comment.