Skip to content

Commit

Permalink
Merge pull request #3 from modeseven-os-climate/rtd-config-changes
Browse files Browse the repository at this point in the history
Rtd config changes
  • Loading branch information
ModeSevenIndustrialSolutions authored Mar 13, 2024
2 parents e2a84c3 + fec7f9c commit def7877
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 84 deletions.
32 changes: 8 additions & 24 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
87 changes: 82 additions & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +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

extensions = ["sphinx_pyproject"]
# show the members in the order they appear in the source code, you can use the autodoc_member_order option.
autodoc_member_order = "bysource"
4 changes: 3 additions & 1 deletion docs/requirements-docs.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
sphinx==5.3.0
sphinx-pyproject
sphinxcontrib-details-directive
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
Expand Down
70 changes: 16 additions & 54 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down Expand Up @@ -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"

Expand All @@ -64,46 +78,6 @@ test = [
"pytest-cov",
"sphinx-pyproject"
]
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",
Expand All @@ -117,7 +91,7 @@ lint = [
pandas = []
dev = [
"pandas>=2.0.3",
"geopandas>=0.13.2",
"geopandas>=0.13.2"
]

[tool.pdm.scripts]
Expand All @@ -129,23 +103,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
Expand Down

0 comments on commit def7877

Please sign in to comment.