diff --git a/.github/workflows/sphinx_doc.yml b/.github/workflows/sphinx_doc.yml new file mode 100644 index 0000000..6b50cc5 --- /dev/null +++ b/.github/workflows/sphinx_doc.yml @@ -0,0 +1,37 @@ +name: documentation + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + - name: Set up Python 3.10 + uses: actions/setup-python@v2 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ghp-import sphinx sphinx_rtd_theme -e . + + - name: Build HTML + run: | + cd docs/ + make html + - name: Run ghp-import + run: | + ghp-import -n -p -f docs/_build/html \ No newline at end of file diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d4bb2cb --- /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 = . +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/conf.py b/docs/conf.py new file mode 100644 index 0000000..40f79e8 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,37 @@ +import os +import sys + +import med_bench +import med_bench.get_estimation +import med_bench.get_simulated_data +import med_bench.mediation +import med_bench.utils +import med_bench.utils.utils +import med_bench.utils.nuisances + + +sys.path.insert(0, os.path.abspath('../')) + +project = 'med_bench' +copyright = '2024, Judith Abecassis, Houssam Zenati, Bertrand Thirion, Hadrien Mariaccia, Mouad Zbakh' +author = 'Judith Abecassis, Houssam Zenati, Bertrand Thirion, Hadrien Mariaccia, Mouad Zbakh' + +# -- 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.githubpages' +] + +templates_path = ['_templates'] +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.venv'] + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = 'sphinx_rtd_theme' +html_static_path = ['_static'] diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..e4fbf4e --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,22 @@ +.. med_bench documentation master file, created by + sphinx-quickstart on Tue Apr 9 16:50:56 2024. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to med_bench's documentation! +===================================== + +.. toctree:: + :maxdepth: 4 + :caption: Contents: + + modules + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..32bb245 --- /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=. +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/modules.rst b/docs/modules.rst new file mode 100644 index 0000000..ae7f15f --- /dev/null +++ b/docs/modules.rst @@ -0,0 +1,57 @@ +.. toctree:: + :maxdepth: 4 + :caption: Contents: + + +med_bench +================= +.. automodule:: med_bench + :members: + :undoc-members: + :show-inheritance: + + +get_estimation +-------- + +.. automodule:: med_bench.get_estimation + :members: + :undoc-members: + :show-inheritance: + + +get_simulated_data +-------- + +.. automodule:: med_bench.get_simulated_data + :members: + :undoc-members: + :show-inheritance: + + +mediation +-------- + +.. automodule:: med_bench.mediation + :members: + :undoc-members: + :show-inheritance: + + +utils +-------- + +.. automodule:: med_bench.utils.utils + :members: + :undoc-members: + :show-inheritance: + + +nuisances +-------- + +.. automodule:: med_bench.utils.nuisances + :members: + :undoc-members: + :show-inheritance: +