From c9e1b2bd0858201242724bf324ce50d6c5057ae9 Mon Sep 17 00:00:00 2001 From: Aleksandrs Krivickis Date: Sun, 14 Apr 2024 20:15:13 +0100 Subject: [PATCH 1/5] Added autodoc --- .github/workflows/documentation.yml | 52 +++++++++++++++++++ docs/Makefile | 20 ++++++++ docs/make.bat | 35 +++++++++++++ docs/source/conf.py | 41 +++++++++++++++ docs/source/index.rst | 21 ++++++++ docs/source/modules.rst | 8 +++ docs/source/readme.rst | 5 ++ docs/source/setup.rst | 7 +++ docs/source/tika.rst | 77 +++++++++++++++++++++++++++++ docs/source/tika.tests.rst | 77 +++++++++++++++++++++++++++++ 10 files changed, 343 insertions(+) create mode 100644 .github/workflows/documentation.yml create mode 100644 docs/Makefile create mode 100644 docs/make.bat create mode 100644 docs/source/conf.py create mode 100644 docs/source/index.rst create mode 100644 docs/source/modules.rst create mode 100644 docs/source/readme.rst create mode 100644 docs/source/setup.rst create mode 100644 docs/source/tika.rst create mode 100644 docs/source/tika.tests.rst diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 0000000..c46a513 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,52 @@ +# Simple workflow for deploying static content to GitHub Pages +name: Generate and deploy documentation + +on: + # Runs on pushes targeting the default branch + push: + branches: ["main", "automated-documentation"] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: write + pages: write + id-token: write + +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + # Single deploy job since we're just deploying + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install dependencies + run: | + pip install sphinx furo myst-parser + - name: Sphinx APIDoc + run: | + sphinx-apidoc -f -o docs/source/ . + - name: Sphinx build + run: | + sphinx-build -b html docs/source/ docs/build/html + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + # Upload entire repository + path: './docs/build/html' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d0c3cbf --- /dev/null +++ b/docs/Makefile @@ -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) diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..dc1312a --- /dev/null +++ b/docs/make.bat @@ -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 diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..d083026 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,41 @@ +# 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 +import os +import sys + +# Add the parent directory of the documentation root to sys.path +sys.path.insert(0, os.path.abspath("../..")) + +project = 'tika-python' +copyright = '2024, Chris A. Mattmann' +author = 'Chris A. Mattmann' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.viewcode", + "sphinx.ext.napoleon", + "sphinx.ext.doctest", + "sphinx.ext.autosectionlabel", + "sphinx.ext.todo", + "sphinx.ext.duration", + "myst_parser" +] + +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 = 'furo' +html_static_path = ['_static'] diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..d939ac5 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,21 @@ +.. tika-python documentation master file, created by + sphinx-quickstart on Sun Apr 14 20:07:31 2024. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to tika-python's documentation! +======================================= + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + readme + tika + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/source/modules.rst b/docs/source/modules.rst new file mode 100644 index 0000000..ed38b54 --- /dev/null +++ b/docs/source/modules.rst @@ -0,0 +1,8 @@ +tika-python +=========== + +.. toctree:: + :maxdepth: 4 + + setup + tika diff --git a/docs/source/readme.rst b/docs/source/readme.rst new file mode 100644 index 0000000..13e1746 --- /dev/null +++ b/docs/source/readme.rst @@ -0,0 +1,5 @@ +README.md +========== + +.. include:: ../../README.md + :parser: myst_parser.sphinx_ \ No newline at end of file diff --git a/docs/source/setup.rst b/docs/source/setup.rst new file mode 100644 index 0000000..552eb49 --- /dev/null +++ b/docs/source/setup.rst @@ -0,0 +1,7 @@ +setup module +============ + +.. automodule:: setup + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/tika.rst b/docs/source/tika.rst new file mode 100644 index 0000000..9c0d903 --- /dev/null +++ b/docs/source/tika.rst @@ -0,0 +1,77 @@ +tika package +============ + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + tika.tests + +Submodules +---------- + +tika.config module +------------------ + +.. automodule:: tika.config + :members: + :undoc-members: + :show-inheritance: + +tika.detector module +-------------------- + +.. automodule:: tika.detector + :members: + :undoc-members: + :show-inheritance: + +tika.language module +-------------------- + +.. automodule:: tika.language + :members: + :undoc-members: + :show-inheritance: + +tika.parser module +------------------ + +.. automodule:: tika.parser + :members: + :undoc-members: + :show-inheritance: + +tika.tika module +---------------- + +.. automodule:: tika.tika + :members: + :undoc-members: + :show-inheritance: + +tika.translate module +--------------------- + +.. automodule:: tika.translate + :members: + :undoc-members: + :show-inheritance: + +tika.unpack module +------------------ + +.. automodule:: tika.unpack + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: tika + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/tika.tests.rst b/docs/source/tika.tests.rst new file mode 100644 index 0000000..70f525c --- /dev/null +++ b/docs/source/tika.tests.rst @@ -0,0 +1,77 @@ +tika.tests package +================== + +Submodules +---------- + +tika.tests.memory\_benchmark module +----------------------------------- + +.. automodule:: tika.tests.memory_benchmark + :members: + :undoc-members: + :show-inheritance: + +tika.tests.test\_benchmark module +--------------------------------- + +.. automodule:: tika.tests.test_benchmark + :members: + :undoc-members: + :show-inheritance: + +tika.tests.test\_from\_file\_service module +------------------------------------------- + +.. automodule:: tika.tests.test_from_file_service + :members: + :undoc-members: + :show-inheritance: + +tika.tests.test\_ssl\_link module +--------------------------------- + +.. automodule:: tika.tests.test_ssl_link + :members: + :undoc-members: + :show-inheritance: + +tika.tests.test\_tika module +---------------------------- + +.. automodule:: tika.tests.test_tika + :members: + :undoc-members: + :show-inheritance: + +tika.tests.tests\_params module +------------------------------- + +.. automodule:: tika.tests.tests_params + :members: + :undoc-members: + :show-inheritance: + +tika.tests.tests\_unpack module +------------------------------- + +.. automodule:: tika.tests.tests_unpack + :members: + :undoc-members: + :show-inheritance: + +tika.tests.utils module +----------------------- + +.. automodule:: tika.tests.utils + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: tika.tests + :members: + :undoc-members: + :show-inheritance: From 35bd8e1aac108d7300f6d81adb9ae07ce6e0630b Mon Sep 17 00:00:00 2001 From: Aleksandrs Krivickis <31312663+aleksandrskrivickis@users.noreply.github.com> Date: Sun, 14 Apr 2024 20:16:36 +0100 Subject: [PATCH 2/5] Update documentation.yml --- .github/workflows/documentation.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index c46a513..b9ae812 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -4,7 +4,7 @@ name: Generate and deploy documentation on: # Runs on pushes targeting the default branch push: - branches: ["main", "automated-documentation"] + branches: ["main", "add-automated-documentation"] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -49,4 +49,4 @@ jobs: path: './docs/build/html' - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v4 \ No newline at end of file + uses: actions/deploy-pages@v4 From 4e21a4f873694cb540c209924da831580db846ef Mon Sep 17 00:00:00 2001 From: Aleksandrs Krivickis <31312663+aleksandrskrivickis@users.noreply.github.com> Date: Sun, 14 Apr 2024 20:21:06 +0100 Subject: [PATCH 3/5] Update documentation.yml --- .github/workflows/documentation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index b9ae812..f701990 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -4,7 +4,7 @@ name: Generate and deploy documentation on: # Runs on pushes targeting the default branch push: - branches: ["main", "add-automated-documentation"] + branches: ["main", "master", "add-automated-documentation"] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: From 055d347acb4db06b7bef4f2a175517a0382da0ba Mon Sep 17 00:00:00 2001 From: Aleksandrs Krivickis Date: Sun, 14 Apr 2024 20:29:37 +0100 Subject: [PATCH 4/5] Adjusted autodoc toc tree max depth. --- docs/source/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index d939ac5..dfc67b6 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -7,7 +7,7 @@ Welcome to tika-python's documentation! ======================================= .. toctree:: - :maxdepth: 2 + :maxdepth: 7 :caption: Contents: readme From eb370dc07847b00c44206f28da9955b16712ed69 Mon Sep 17 00:00:00 2001 From: Aleksandrs Krivickis Date: Sun, 14 Apr 2024 20:38:58 +0100 Subject: [PATCH 5/5] Removed tests from html generation --- docs/source/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index d083026..52d5608 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -30,7 +30,7 @@ ] templates_path = ['_templates'] -exclude_patterns = [] +exclude_patterns = ['tika.tests*']