|
| 1 | +import datetime |
| 2 | +import sys |
| 3 | + |
| 4 | +import ocr |
| 5 | + |
| 6 | +print('python exec:', sys.executable) |
| 7 | +print('sys.path:', sys.path) |
| 8 | + |
| 9 | + |
| 10 | +project = 'OCR' |
| 11 | +this_year = datetime.datetime.now().year |
| 12 | +copyright = f'{this_year}, CarbonPlan' |
| 13 | +author = 'CarbonPlan' |
| 14 | + |
| 15 | +release = ocr.__version__ |
| 16 | + |
| 17 | +# -- General configuration --------------------------------------------------- |
| 18 | +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration |
| 19 | + |
| 20 | +extensions = [ |
| 21 | + 'sphinx.ext.autodoc', |
| 22 | + 'sphinx.ext.viewcode', |
| 23 | + 'sphinx.ext.autosummary', |
| 24 | + 'sphinx.ext.doctest', |
| 25 | + 'sphinx.ext.intersphinx', |
| 26 | + 'sphinx.ext.extlinks', |
| 27 | + 'sphinx.ext.napoleon', |
| 28 | + 'sphinx.ext.mathjax', |
| 29 | + 'myst_nb', |
| 30 | + 'sphinxext.opengraph', |
| 31 | + 'sphinx_copybutton', |
| 32 | + 'sphinx_design', |
| 33 | + 'sphinxcontrib.mermaid', |
| 34 | + 'sphinx_click', |
| 35 | +] |
| 36 | + |
| 37 | +# MyST config |
| 38 | +myst_enable_extensions = [ |
| 39 | + 'amsmath', |
| 40 | + 'dollarmath', |
| 41 | + 'colon_fence', |
| 42 | + 'deflist', |
| 43 | + 'html_image', |
| 44 | + 'tasklist', |
| 45 | +] |
| 46 | +myst_url_schemes = ['http', 'https', 'mailto'] |
| 47 | +myst_fence_as_directive = ['mermaid'] |
| 48 | +myst_heading_anchors = 2 |
| 49 | + |
| 50 | +# sphinx-copybutton configurations |
| 51 | +copybutton_prompt_text = r'>>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: ' |
| 52 | +copybutton_prompt_is_regexp = True |
| 53 | + |
| 54 | +# Autodoc configuration |
| 55 | +autodoc_default_options = { |
| 56 | + 'members': True, |
| 57 | + 'member-order': 'bysource', |
| 58 | + 'undoc-members': True, |
| 59 | + 'exclude-members': '__weakref__', |
| 60 | +} |
| 61 | +autodoc_typehints = 'description' |
| 62 | +autodoc_typehints_description_target = 'documented' |
| 63 | +# Don't show private members (those starting with _) |
| 64 | +autodoc_default_flags = ['members', 'show-inheritance'] |
| 65 | + |
| 66 | +autosummary_generate = True |
| 67 | + |
| 68 | +nb_execution_mode = 'off' |
| 69 | +nb_execution_timeout = 600 |
| 70 | +nb_execution_raise_on_error = False |
| 71 | + |
| 72 | +# Mermaid configuration |
| 73 | +mermaid_output_format = 'raw' |
| 74 | +mermaid_version = '11.4.0' |
| 75 | +mermaid_d3_zoom = True # Enable zoom functionality |
| 76 | +d3_version = '7.9.0' # D3 version for zoom |
| 77 | + |
| 78 | + |
| 79 | +# Intersphinx mapping |
| 80 | +intersphinx_mapping = { |
| 81 | + 'python': ('https://docs.python.org/3/', None), |
| 82 | + 'geopandas': ('https://geopandas.org/en/stable/', None), |
| 83 | + 'numpy': ('https://numpy.org/doc/stable/', None), |
| 84 | + 'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None), |
| 85 | + 'xarray': ('https://docs.xarray.dev/en/stable/', None), |
| 86 | + 'icechunk': ('https://icechunk.io/en/stable/', None), |
| 87 | +} |
| 88 | + |
| 89 | +templates_path = ['_templates'] |
| 90 | +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '**/.ipynb_checkpoints'] |
| 91 | +source_suffix = ['.rst', '.md'] |
| 92 | + |
| 93 | + |
| 94 | +# -- Options for HTML output ------------------------------------------------- |
| 95 | +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output |
| 96 | + |
| 97 | +html_theme = 'sphinx_book_theme' |
| 98 | +html_title = 'Open Climate Risk' |
| 99 | +html_favicon = 'assets/favicon-180x180-light.png' |
| 100 | + |
| 101 | +html_theme_options = { |
| 102 | + 'repository_url': 'https://github.com/carbonplan/ocr', |
| 103 | + 'repository_branch': 'main', |
| 104 | + 'path_to_docs': 'docs', |
| 105 | + 'use_repository_button': True, |
| 106 | + 'use_edit_page_button': True, |
| 107 | + 'use_issues_button': True, |
| 108 | + 'use_download_button': True, |
| 109 | + 'use_fullscreen_button': True, |
| 110 | + 'home_page_in_toc': True, |
| 111 | + 'show_toc_level': 2, |
| 112 | + 'logo': { |
| 113 | + 'image_light': 'assets/monogram-dark-cropped.png', |
| 114 | + 'image_dark': 'assets/monogram-light-cropped.png', |
| 115 | + }, |
| 116 | +} |
| 117 | + |
| 118 | +html_static_path = ['assets'] |
| 119 | + |
| 120 | + |
| 121 | +# OpenGraph configuration |
| 122 | +ogp_site_url = 'https://open-climate-risk.readthedocs.io/' |
| 123 | +ogp_site_name = 'Open Climate Risk' |
| 124 | +ogp_description = ( |
| 125 | + 'Building-level climate risk assessments across the continental United States. ' |
| 126 | + 'Access fire and wind risk data, explore methodologies, and analyze climate impacts.' |
| 127 | +) |
| 128 | +ogp_type = 'website' |
| 129 | +# ogp_image = '' |
| 130 | +ogp_image_alt = 'Open Climate Risk - CarbonPlan' |
| 131 | +ogp_image_width = '1200' # Optimal for LinkedIn, Bluesky, Twitter |
| 132 | +ogp_image_height = '630' # Standard social card dimensions (1.91:1 ratio) |
| 133 | +ogp_description_length = 200 |
| 134 | +ogp_enable_meta_description = True |
| 135 | +ogp_use_first_image = True # Use first image in page if available |
| 136 | + |
| 137 | +# Social cards configuration - generates cards automatically |
| 138 | +ogp_social_cards = { |
| 139 | + 'enable': True, |
| 140 | +} |
| 141 | + |
| 142 | +# Custom meta tags for enhanced social media support |
| 143 | +# These work across Bluesky, LinkedIn, and Facebook |
| 144 | +ogp_custom_meta_tags = [ |
| 145 | + # Additional metadata for better indexing |
| 146 | + '<meta property="article:author" content="CarbonPlan" />', |
| 147 | + '<meta name="author" content="CarbonPlan" />', |
| 148 | +] |
0 commit comments