Debian Codegraph @

docs/conf.py

raw
1 import os
2 import pathlib
3 import sys
4
5 from pkg_resources import get_distribution
6
7 BASE_DIR = pathlib.Path(__file__).resolve(strict=True).parent.parent
8
9 # This is needed since django_select2 requires django model modules
10 # and those modules assume that django settings is configured and
11 # have proper DB settings.
12 # Using this we give a proper environment with working django settings.
13 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.testapp.settings")
14
15 # If extensions (or modules to document with autodoc) are in another directory,
16 # add these directories to sys.path here. If the directory is relative to the
17 # documentation root, use os.path.abspath to make it absolute, like shown here.
18 sys.path.insert(0, str(BASE_DIR / "tests" / "testapp"))
19 sys.path.insert(0, str(BASE_DIR))
20
21
22 project = "Django-Select2"
23 author = "Johannes Hoppe"
24 copyright = "2017-2020, Johannes Hoppe"
25 release = get_distribution("django_select2").version
26 version = ".".join(release.split(".")[:2])
27
28
29 master_doc = "index" # default in Sphinx v2
30
31
32 extensions = [
33 "sphinx.ext.autodoc",
34 "sphinx.ext.napoleon",
35 "sphinx.ext.inheritance_diagram",
36 "sphinx.ext.intersphinx",
37 "sphinx.ext.viewcode",
38 "sphinx.ext.doctest",
39 ]
40
41 intersphinx_mapping = {
42 "python": ("https://docs.python.org/3", None),
43 "django": (
44 "https://docs.djangoproject.com/en/stable/",
45 "https://docs.djangoproject.com/en/stable/_objects/",
46 ),
47 }
48
49 autodoc_default_flags = ["members", "show-inheritance"]
50 autodoc_member_order = "bysource"
51
52 inheritance_graph_attrs = dict(rankdir="TB")
53
54 inheritance_node_attrs = dict(
55 shape="rect", fontsize=14, fillcolor="gray90", color="gray30", style="filled"
56 )
57
58 inheritance_edge_attrs = dict(penwidth=0.75)