File: conf.py

package info (click to toggle)
osmnx 2.0.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 776 kB
  • sloc: python: 4,737; sh: 40; makefile: 33
file content (69 lines) | stat: -rw-r--r-- 2,045 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# ruff: noqa: INP001
"""
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 re
import sys
from pathlib import Path

# project info
author = "Geoff Boeing"
copyright = "2016-2025, Geoff Boeing"  # noqa: A001
project = "OSMnx"

# go up two levels from current working dir (/docs/source) to package root
pkg_root_path = str(Path.cwd().parent.parent)
sys.path.insert(0, pkg_root_path)

# dynamically load version from __version__ variable in /osmnx/_version.py
file_text = Path("../../osmnx/_version.py").read_text(encoding="utf-8")
regex = re.compile("^__version__ = ['\"]([^'\"]*)['\"]", re.MULTILINE)
match = re.search(regex, file_text)
if match:
    version = release = match.group(1)
else:
    msg = "Unable to find version string in file."
    raise ValueError(msg)

# mock import all required + optional dependency packages because readthedocs
# does not have them installed
autodoc_mock_imports = [
    "geopandas",
    "matplotlib",
    "networkx",
    "numpy",
    "pandas",
    "rasterio",
    "requests",
    "rio-vrt",
    "scipy",
    "shapely",
    "sklearn",
]

# linkcheck for stackoverflow gets HTTP 403 in CI environment
linkcheck_ignore = [r"https://stackoverflow\.com/.*"]

# type annotations configuration
autodoc_typehints = "description"
napoleon_use_param = True
napoleon_use_rtype = False
typehints_document_rtype = True
typehints_use_rtype = False
typehints_fully_qualified = False

# general configuration and options for HTML output
# see https://www.sphinx-doc.org/en/master/usage/configuration.html
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
extensions = ["sphinx.ext.autodoc", "sphinx.ext.napoleon", "sphinx_autodoc_typehints"]
html_static_path: list[str] = []
html_theme = "furo"
language = "en"
needs_sphinx = "7"  # match version from pyproject.toml optional-dependencies
root_doc = "index"
source_suffix = ".rst"
templates_path: list[str] = []