diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..f516010 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,41 @@ +# Read the Docs configuration file for Sphinx projects +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the OS, Python version and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.10" + # You can also specify other tool versions: + # nodejs: "20" + # rust: "1.70" + # golang: "1.20" + apt_packages: + - build-essential + - libglu1-mesa + - xvfb + - clang + - swig + +# Build documentation in the "docs/" directory with Sphinx +sphinx: + configuration: docs/source/conf.py + # You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs + # builder: "dirhtml" + # Fail on all warnings to avoid broken references + # fail_on_warning: true + +# Optionally build your docs in additional formats such as PDF and ePub +# formats: +# - pdf +# - epub + +# Optional but recommended, declare the Python requirements required +# to build your documentation +# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html +python: + install: + - requirements: requirements.lock \ No newline at end of file diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..3c9dbc4 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,29 @@ +# 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) + +.PHONY: server +server: + python3 -m http.server --directory build/html/ + +.PHONY: test +test: + make html + make server \ No newline at end of file diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..9534b01 --- /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 + +if "%1" == "" goto help + +%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.http://sphinx-doc.org/ + exit /b 1 +) + +%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..d47b1bf --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,151 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# 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. +# +import os +import sys +from unittest.mock import MagicMock + + +class Mock(MagicMock): + @classmethod + def __getattr__(cls, name): + return MagicMock() + + +sys.path.insert(0, os.path.abspath("../../")) +sys.setrecursionlimit(1500) +MOCK_MODULES = [] +sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES) + +# -- Project information ----------------------------------------------------- +project = "hydraclick" +copyright = "2024, FragileTech" +author = "Guillem Duran Ballester" + +# The short X.Y version +from hydraclick.version import __version__ + + +version = __version__ +# The full version, including alpha/beta/rc tags +release = __version__ +# -- General configuration --------------------------------------------------- +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ["_build", "**.ipynb_checkpoints"] +# The master toctree document. +master_doc = "index" +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx.ext.autodoc", + "autoapi.extension", + "sphinx.ext.doctest", + "sphinx.ext.intersphinx", + "sphinx.ext.todo", + "sphinx.ext.coverage", + "sphinx.ext.imgmath", + "sphinx.ext.viewcode", + "sphinx.ext.napoleon", + "sphinx.ext.autosectionlabel", + "sphinx.ext.autodoc.typehints", + "sphinx_book_theme", + "myst_nb", + "sphinxcontrib.mermaid", + "sphinx.ext.githubpages", + "sphinx_copybutton", + "sphinx_togglebutton", +] +suppress_warnings = ["image.nonlocal_uri"] +autodoc_typehints = "description" +# Autoapi settings +autoapi_type = "python" +autoapi_dirs = ["../../src/hydraclick"] +autoapi_add_toctree_entry = True +# Make use of custom templates +autoapi_template_dir = "_autoapi_templates" +exclude_patterns.append("_autoapi_templates/index.rst") + +# Ignore sphinx-autoapi warnings on multiple target description +suppress_warnings.append("ref.python") + +# Napoleon settings +napoleon_google_docstring = True +napoleon_numpy_docstring = True +napoleon_include_init_with_doc = True +napoleon_include_private_with_doc = False +napoleon_include_special_with_doc = True +napoleon_use_admonition_for_examples = False +napoleon_use_admonition_for_notes = False +napoleon_use_admonition_for_references = False +napoleon_use_ivar = False +napoleon_use_param = True +napoleon_use_rtype = True + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = [] + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_title = "" +html_theme = "sphinx_book_theme" +# html_logo = "_static/logo-wide.svg" +# html_favicon = "_static/logo-square.svg" +html_theme_options = { + "github_url": "https://github.com/fragiletech/hydraclick", + "repository_url": "https://github.com/fragiletech/hydraclick", + "repository_branch": "gh-pages", + "home_page_in_toc": True, + "path_to_docs": "docs", + "show_navbar_depth": 1, + "use_edit_page_button": True, + "use_repository_button": True, + "use_download_button": True, + "launch_buttons": { + "binderhub_url": "https://mybinder.org", + "notebook_interface": "classic", + }, +} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["_static"] + +# myst_parser options +nb_execution_mode = "off" +myst_heading_anchors = 2 +myst_enable_extensions = [ + "amsmath", + "colon_fence", + "deflist", + "dollarmath", + "html_admonition", + "html_image", + "linkify", + "replacements", + "smartquotes", + "substitution", +] + + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = True diff --git a/docs/source/index.md b/docs/source/index.md new file mode 100644 index 0000000..71afd12 --- /dev/null +++ b/docs/source/index.md @@ -0,0 +1,10 @@ +```{include} ../../README.md +``` + +```{toctree} +--- +maxdepth: 2 +caption: API Reference +--- +autoapi/index.rst +``` \ No newline at end of file diff --git a/docs/source/markdown/readme.md b/docs/source/markdown/readme.md new file mode 100644 index 0000000..baba687 --- /dev/null +++ b/docs/source/markdown/readme.md @@ -0,0 +1,2 @@ +```{include} ../../../README.md +``` \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 3ef8468..ff52e24 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,14 +28,12 @@ classifiers = [ ] dependencies = [ "click>=8.1.7", - "flogging", - "frozendict", "hydra-core", - "python-dotenv", - "setuptools", - "terminaltexteffects>=0.11.0", ] [project.optional-dependencies] +flogging = ["flogging>=0.0.22"] +terminal-effects = ["terminaltexteffects>=0.11.0"] +all = ["flogging>=0.0.22", "terminaltexteffects>=0.11.0"] test = [ "psutil>=5.8.0", "pytest>=6.2.5",