From cac9c7efae7e0c47087ebe345dca1dc3cb51ec51 Mon Sep 17 00:00:00 2001 From: Matthew Watkins Date: Wed, 13 Mar 2024 12:54:22 +0000 Subject: [PATCH 1/3] Chore: Migrate RTD back to original schemea/configuration Signed-off-by: Matthew Watkins --- .readthedocs.yaml | 32 ++++---------- docs/conf.py | 87 ++++++++++++++++++++++++++++++++++++-- docs/conf.py.backup | 101 -------------------------------------------- pyproject.toml | 70 +++++++----------------------- 4 files changed, 107 insertions(+), 183 deletions(-) delete mode 100644 docs/conf.py.backup diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 956e8b48..e0f7cc1e 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -11,34 +11,18 @@ build: tools: python: "3.9" -# The below will effectively execute: -# pip install .[docs] -python: - install: - - method: pip - path: . - extra_requirements: - - docs - - -### Disabled due to configuration migrated to pyproject.toml ### - -# We are using a metadata file to describe code dependencies , pyproject.toml -# Use the extra_requirements option in that file (see Packages) -# As such, the options below are redundant and now commented out - # Build documentation in the "docs/" directory with Sphinx -#sphinx: -# configuration: docs/conf.py +sphinx: + configuration: docs/conf.py # Optionally build your docs in additional formats such as PDF and ePub -# formats: -# - pdf -# - 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: docs/requirements-docs.txt +python: + install: + - requirements: docs/requirements-docs.txt diff --git a/docs/conf.py b/docs/conf.py index dd13b7e4..e19e907f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -6,11 +6,90 @@ import os import sys -# Migrate as much of the configuration as possible into pyproject.toml -from sphinx_pyproject import SphinxConfig - # sys.path.insert(0, os.path.abspath('.')) sys.path.insert(0, os.path.abspath("..")) sys.path.insert(0, os.path.abspath("../src/")) -config = SphinxConfig("../pyproject.toml", globalns=globals()) +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = "PhysicalRisk" +copyright = "2024, DCV" +author = "DCV" + +# The full version, including alpha/beta/rc tags +# release = "1.1.0" + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +# The master toctree document. +master_doc = "index" + +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.napoleon", + "sphinx_toolbox.installation", + "sphinx_toolbox.latex", + "sphinx.ext.autosummary", + "sphinx.ext.graphviz", + "sphinx.ext.inheritance_diagram", + "sphinx.ext.autosectionlabel", + "sphinx_design", + "sphinx.ext.intersphinx", + # 'myst_nb', + # "myst_parser", + "nbsphinx", + "sphinxcontrib.details.directive", + "sphinxcontrib.bibtex", + "sphinx.ext.mathjax", + "sphinx_simplepdf", +] + +bibtex_bibfiles = ["references.bib"] +bibtex_default_style = "alpha" +bibtex_encoding = "latin" + +templates_path = ["_templates"] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] + +# Not show module +python_module_index = False + +# Summary +autosummary_generate = True + +# Docstrings of private methods +autodoc_default_options = {"members": True, "undoc-members": True, "private-members": False} + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_logo = "images/OS-Climate-Logo.png" +html_theme = "pydata_sphinx_theme" +html_static_path = ["_static"] + +# Don't show the code +html_show_sourcelink = True + +html_theme_options = { + # 'logo_only': False, + # 'display_version': False, + # Table of contents options + "collapse_navigation": False, +} + +html_sidebars = { + "**": [ + "globaltoc.html", # Índice general + # 'localtoc.html', # Índice local para cada archivo + "searchbox.html", # Cuadro de búsqueda + ] +} + +# This setting ensures that each section in your documentation is automatically assigned +# a unique label based on the document it belongs to. +autosectionlabel_prefix_document = True + +# show the members in the order they appear in the source code, you can use the autodoc_member_order option. +autodoc_member_order = "bysource" diff --git a/docs/conf.py.backup b/docs/conf.py.backup deleted file mode 100644 index 4dca497a..00000000 --- a/docs/conf.py.backup +++ /dev/null @@ -1,101 +0,0 @@ -# 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 - -import os -import sys - -# sys.path.insert(0, os.path.abspath('.')) -sys.path.insert(0, os.path.abspath("..")) -sys.path.insert(0, os.path.abspath("../src/")) - -# Migrate as much of the configuration as possible into pyproject.toml -from sphinx_pyproject import SphinxConfig -config = SphinxConfig("../pyproject.toml", globalns=globals()) - - - -# -- Project information ----------------------------------------------------- -# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information - -#project = "PhysicalRisk" -#copyright = "2024, DCV" -#author = "DCV" - -# The full version, including alpha/beta/rc tags -#release = "1.1.0" - -# -- General configuration --------------------------------------------------- -# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration - -# The master toctree document. -master_doc = "index" - -extensions = [ - "sphinx.ext.autodoc", - "sphinx.ext.napoleon", - "sphinx_toolbox.installation", - "sphinx_toolbox.latex", - "sphinx.ext.autosummary", - "sphinx.ext.graphviz", - "sphinx.ext.inheritance_diagram", - "sphinx.ext.autosectionlabel", - "sphinx_design", - "sphinx.ext.intersphinx", - # 'myst_nb', - # "myst_parser", - "nbsphinx", - # "sphinxcontrib.details" - "sphinxcontrib.bibtex", - "sphinx.ext.mathjax", - "sphinx_simplepdf", -] - -bibtex_bibfiles = ["references.bib"] -bibtex_default_style = "alpha" -bibtex_encoding = "latin" - -templates_path = ["_templates"] -exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] - -# Not show module -python_module_index = False - -# Summary -autosummary_generate = True - -# Docstrings of private methods -autodoc_default_options = {"members": True, "undoc-members": True, "private-members": False} - -# -- Options for HTML output ------------------------------------------------- -# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output - -html_logo = "images/OS-Climate-Logo.png" -html_theme = "pydata_sphinx_theme" -html_static_path = ["_static"] - -# Don't show the code -html_show_sourcelink = True - -html_theme_options = { - # 'logo_only': False, - # 'display_version': False, - # Table of contents options - "collapse_navigation": False, -} - -html_sidebars = { - "**": [ - "globaltoc.html", # Índice general - # 'localtoc.html', # Índice local para cada archivo - "searchbox.html", # Cuadro de búsqueda - ] -} - -# This setting ensures that each section in your documentation is automatically assigned -# a unique label based on the document it belongs to. -autosectionlabel_prefix_document = True - -# show the members in the order they appear in the source code, you can use the autodoc_member_order option. -autodoc_member_order = "bysource" diff --git a/pyproject.toml b/pyproject.toml index f7b62d4a..fe4b4ba8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,7 @@ [project] name = "physrisk-lib" +# Could test changing the below to be sourced "dynamically" +# dynamic = ['version'] version = "0.25.0" description = "OS-Climate Physical Risk Library" authors = [ @@ -46,10 +48,22 @@ dependencies = [ "zarr>=2.10.3" ] +[project.urls] +Homepage = "https://github.com/os-climate/physrisk" +Repository = "https://github.com/os-climate/physrisk" +Downloads = "https://github.com/os-climate/physrisk/releases" +"Bug Tracker" = "https://github.com/os-climate/physrisk/issues" +Documentation = "https://github.com/os-climate/physrisk/tree/main/docs" +"Source Code" = "https://github.com/os-climate/physrisk" + +[metadata] +license-files = ["LICENSE"] + [build-system] requires = [ "setuptools>=42", - "wheel" + "wheel", + "pdm" ] build-backend = "setuptools.build_meta" @@ -63,46 +77,6 @@ test = [ "pytest", "pytest-cov" ] -docs = [ - "sphinx", - "linkcheck", - "sphinx-pyproject", - "sphinx-toolbox", - "sphinx-design", - "nbsphinx", - "pydata-sphinx-theme", - "sphinxcontrib-details-directive", - "sphinxcontrib-bibtex", - "sphinx-simplepdf", - "sphinx-design", - "sphinx-toolbox" -] - -[tool.sphinx-pyproject] -project = "PhysicalRisk" -copyright = "2024, DCV" -author = "DCV" -extensions = [ - # Imported from docs/conf.py - "sphinx.ext.autodoc", - "sphinx.ext.napoleon", - "sphinx_toolbox.installation", - "sphinx_toolbox.latex", - "sphinx.ext.autosummary", - "sphinx.ext.graphviz", - "sphinx.ext.inheritance_diagram", - "sphinx.ext.autosectionlabel", - "sphinx_design", - "sphinx.ext.intersphinx", - "nbsphinx", - "sphinxcontrib.details", - "sphinxcontrib.bibtex", - "sphinx.ext.mathjax", - "sphinx_simplepdf" - ## 'myst_nb', - ## "myst_parser", -] - lint = [ "isort", "black", @@ -116,7 +90,7 @@ lint = [ pandas = [] dev = [ "pandas>=2.0.3", - "geopandas>=0.13.2", + "geopandas>=0.13.2" ] [tool.pdm.scripts] @@ -128,23 +102,11 @@ docs = { shell = "cd docs && mkdocs serve", help = "Start the dev server for doc lint = "pre-commit run --all-files" complete = { call = "tasks.complete:main", help = "Create autocomplete files for bash and fish" } - -[project.urls] -Homepage = "https://github.com/os-climate/physrisk" -Repository = "https://github.com/os-climate/physrisk" -Downloads = "https://github.com/os-climate/physrisk/releases" -"Bug Tracker" = "https://github.com/os-climate/physrisk/issues" -Documentation = "https://github.com/os-climate/physrisk/tree/main/docs" -"Source Code" = "https://github.com/os-climate/physrisk" - [tool.pytest.ini_options] testpaths = "tests" addopts = "-v" #addopts = "--cov --cov-report html --cov-report term-missing --cov-fail-under 95" -[metadata] -license-files = ["LICENSE"] - [tool.mypy] warn_unreachable = true ignore_missing_imports = true From 56d460c0f969c8d8ba15b56aa3ba0aef02e48263 Mon Sep 17 00:00:00 2001 From: Matthew Watkins Date: Wed, 13 Mar 2024 13:03:25 +0000 Subject: [PATCH 2/3] Resolve merge conflicts caused by RTD changes --- docs/requirements-docs.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/requirements-docs.txt b/docs/requirements-docs.txt index 86f776a0..b17d0de9 100644 --- a/docs/requirements-docs.txt +++ b/docs/requirements-docs.txt @@ -1,5 +1,5 @@ sphinx==5.3.0 -sphinx-pyproject +sphinxcontrib-details-directive numpydoc==1.0.0 sphinx-copybutton==0.5.0 myst-nb==0.16.0 From fec7f9cb4af73e9f489b15275c9123783dc1cddf Mon Sep 17 00:00:00 2001 From: Matthew Watkins Date: Wed, 13 Mar 2024 13:11:03 +0000 Subject: [PATCH 3/3] Chore: Migrate RTD back to original schemea/configuration Signed-off-by: Matthew Watkins --- docs/requirements-docs.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/requirements-docs.txt b/docs/requirements-docs.txt index b17d0de9..b94f10f3 100644 --- a/docs/requirements-docs.txt +++ b/docs/requirements-docs.txt @@ -4,6 +4,8 @@ numpydoc==1.0.0 sphinx-copybutton==0.5.0 myst-nb==0.16.0 pydata-sphinx-theme==0.13.3 +sphinxcontrib-bibtex +sphinx-toolbox sphinx_toggleprompt==0.2.0 sphinx_design==0.3 sphinx_rtd_theme