Skip to content

Commit

Permalink
unity py added documentation (#38)
Browse files Browse the repository at this point in the history
* added sphinx build directory

* fixed docs build instructions

* added doc generation

* updated poetry version

* updated location of docs

* separate doc build

* added python version

* updated the theme

* updated deploy to docs/ subdir
  • Loading branch information
mike-gangl authored Sep 9, 2024
1 parent 1913cb5 commit dd9a7bc
Show file tree
Hide file tree
Showing 9 changed files with 555 additions and 22 deletions.
44 changes: 43 additions & 1 deletion .github/workflows/unity-py-python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
max-parallel: 2
matrix:
python-version: [ "3.8", "3.9", "3.10" ]
poetry-version: [ "1.5.1" ]
poetry-version: [ "1.8.3" ]
# os: [ ubuntu-18.04, macos-latest, windows-latest ]
os: [ ubuntu-22.04, macos-latest ]
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -133,3 +133,45 @@ jobs:
packages-dir: ./libs/unity-py/dist
outputs:
publishedVersion: ${{ steps.get-version.outputs.current_version }}
docs:
needs: build
defaults:
run:
working-directory: ./libs/unity-py
strategy:
fail-fast: false
matrix:
python-version: [ "3.10" ]
poetry-version: [ "1.8.3" ]
os: [ ubuntu-22.04 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: abatilo/[email protected]
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: |
poetry self add poetry-monorepo-dependency-plugin
poetry install --with docs
- name: build docs
run: |
poetry run sphinx-apidoc -f -o docs/source/ unity_sds_client
poetry run sphinx-build -M html docs/source docs/build/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: html-docs
path: ./libs/unity-py/docs/build/html/
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./libs/unity-py/docs/build/html
destination_dir: docs/unity-sds-client
10 changes: 10 additions & 0 deletions libs/unity-py/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.6.1] - 2024-09-05
### Added
* Added sphinx doc gen
### Fixed
### Changed
### Removed
### Security
### Deprecated


## [0.6.0] - 2024-08-13
### Added
* Added app-pacakge build system client and integrations
Expand Down
15 changes: 12 additions & 3 deletions libs/unity-py/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Unity-Py provides a seamless way to interact with NASA's Unity Platform using Py

* Pythonic interface to NASA's Unity Platform
* Support for interactive and environment variable-based authorization

## Contents

* [Quick Start](#quick-start)
Expand All @@ -41,8 +41,8 @@ Unity-Py provides a seamless way to interact with NASA's Unity Platform using Py
Development Requirements

* poetry
* [poetry-monorepo-dependency-plugin](https://pypi.org/project/poetry-monorepo-dependency-plugin/)
* [poetry-monorepo-dependency-plugin](https://pypi.org/project/poetry-monorepo-dependency-plugin/)

### Setup Instructions

1. Install via pypi:
Expand Down Expand Up @@ -115,6 +115,15 @@ for dataset in cd:
(Not Available Yet)
```

### Documentation Generation
```
poetry install --with docs
poetry run sphinx-apidoc -f -o docs/source/ unity_sds_client
poetry run sphinx-build -M markdown docs/source docs/build
poetry run sphinx-build -M html docs/source docs/build/
```


## Changelog

See our [CHANGELOG.md](CHANGELOG.md) for a history of our changes.
Expand Down
20 changes: 20 additions & 0 deletions libs/unity-py/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 libs/unity-py/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
35 changes: 35 additions & 0 deletions libs/unity-py/docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import os
import sys

# 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.
sys.path.insert(0, os.path.abspath("."))
sys.path.insert(0, os.path.abspath("../../"))
# 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 = "unity-sds-client"
copyright = "2024, unity"
author = "unity"
release = "0.6.0"

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

extensions = ["sphinx.ext.autodoc", "sphinx.ext.napoleon", "sphinx_markdown_builder"]

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 = "alabaster"
html_static_path = ["_static"]
18 changes: 18 additions & 0 deletions libs/unity-py/docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.. unity-sds-client documentation master file, created by
sphinx-quickstart on Wed Sep 4 12:07:51 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
unity-sds-client documentation
==============================

Add your content using ``reStructuredText`` syntax. See the
`reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_
documentation for details.


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

modules
Loading

0 comments on commit dd9a7bc

Please sign in to comment.