diff --git a/doc-source/conf.py b/doc-source/conf.py index 2b30b28..124246d 100644 --- a/doc-source/conf.py +++ b/doc-source/conf.py @@ -12,89 +12,12 @@ sys.path.append('.') -config = SphinxConfig() - -github_username = "repo-helper" -github_repository = "mkrecipe" -author = "Dominic Davis-Foster" -project = "mkrecipe" -copyright = "2020-2021 Dominic Davis-Foster" -language = "en" -package_root = "mkrecipe" -extensions = [ - "sphinx_toolbox", - "sphinx_toolbox.more_autodoc", - "sphinx_toolbox.more_autosummary", - "sphinx_toolbox.documentation_summary", - "sphinx_toolbox.tweaks.param_dash", - "sphinx_toolbox.tweaks.latex_toc", - "sphinx.ext.intersphinx", - "sphinx.ext.mathjax", - "sphinxcontrib.httpdomain", - "sphinxcontrib.extras_require", - "sphinx.ext.todo", - "sphinxemoji.sphinxemoji", - "notfound.extension", - "sphinx_copybutton", - "sphinxcontrib.default_values", - "sphinxcontrib.toctree_plus", - "sphinx_debuginfo", - "seed_intersphinx_mapping", - "sphinx_click", - "configconfig.autoconfig", - "html_section", - ] -sphinxemoji_style = "twemoji" -gitstamp_fmt = "%d %b %Y" -templates_path = ["_templates"] -html_static_path = ["_static"] -source_suffix = ".rst" -master_doc = "index" -suppress_warnings = ["image.nonlocal_uri"] -pygments_style = "default" -html_theme = "furo" -html_theme_path = ["../.."] -html_show_sourcelink = True -toctree_plus_types = [ - "class", - "confval", - "data", - "directive", - "enum", - "exception", - "flag", - "function", - "method", - "namedtuple", - "protocol", - "role", - "typeddict", - ] -add_module_names = False -hide_none_rtype = True -all_typevars = True -overloads_location = "bottom" -documentation_summary = "A tool to create recipes for building conda packages from distributions on PyPI." -autodoc_exclude_members = [ - "__dict__", - "__class__", - "__dir__", - "__weakref__", - "__module__", - "__annotations__", - "__orig_bases__", - "__parameters__", - "__subclasshook__", - "__init_subclass__", - "__attrs_attrs__", - "__init__", - "__new__", - "__getnewargs__", - "__abstractmethods__", - "__hash__", - ] - -github_url = f"https://github.com/{github_username}/{github_repository}" +config = SphinxConfig(globalns=globals()) +project = config["project"] +author = config["author"] +documentation_summary = config.description + +github_url = "https://github.com/{github_username}/{github_repository}".format_map(config) rst_prolog = f""".. |pkgname| replace:: mkrecipe .. |pkgname2| replace:: ``mkrecipe`` @@ -131,14 +54,14 @@ man_pages = [("index", slug, project, [author], 1)] texinfo_documents = [("index", slug, project, author, slug, project, "Miscellaneous")] -toctree_plus_types = set(toctree_plus_types) +toctree_plus_types = set(config["toctree_plus_types"]) autodoc_default_options = { "members": None, # Include all members (methods). "special-members": None, "autosummary": None, "show-inheritance": None, - "exclude-members": ','.join(autodoc_exclude_members), + "exclude-members": ','.join(config["autodoc_exclude_members"]), } nitpicky = True diff --git a/pyproject.toml b/pyproject.toml index 1315b0a..9c804e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,3 +44,83 @@ python-implementations = [ "CPython", "PyPy",] platforms = [ "Windows", "macOS", "Linux",] license-key = "MIT" additional-files = [ "include mkrecipe/recipe_template.ymlt",] + +[tool.sphinx-pyproject] +github_username = "repo-helper" +github_repository = "mkrecipe" +author = "Dominic Davis-Foster" +project = "mkrecipe" +copyright = "2020-2021 Dominic Davis-Foster" +language = "en" +package_root = "mkrecipe" +extensions = [ + "sphinx_toolbox", + "sphinx_toolbox.more_autodoc", + "sphinx_toolbox.more_autosummary", + "sphinx_toolbox.documentation_summary", + "sphinx_toolbox.tweaks.param_dash", + "sphinx_toolbox.tweaks.latex_toc", + "sphinx.ext.intersphinx", + "sphinx.ext.mathjax", + "sphinxcontrib.httpdomain", + "sphinxcontrib.extras_require", + "sphinx.ext.todo", + "sphinxemoji.sphinxemoji", + "notfound.extension", + "sphinx_copybutton", + "sphinxcontrib.default_values", + "sphinxcontrib.toctree_plus", + "sphinx_debuginfo", + "seed_intersphinx_mapping", + "sphinx_click", + "configconfig.autoconfig", + "html_section", +] +sphinxemoji_style = "twemoji" +gitstamp_fmt = "%d %b %Y" +templates_path = [ "_templates",] +html_static_path = [ "_static",] +source_suffix = ".rst" +master_doc = "index" +suppress_warnings = [ "image.nonlocal_uri",] +pygments_style = "default" +html_theme = "furo" +html_theme_path = [ "../..",] +html_show_sourcelink = true +toctree_plus_types = [ + "class", + "confval", + "data", + "directive", + "enum", + "exception", + "flag", + "function", + "method", + "namedtuple", + "protocol", + "role", + "typeddict", +] +add_module_names = false +hide_none_rtype = true +all_typevars = true +overloads_location = "bottom" +autodoc_exclude_members = [ + "__dict__", + "__class__", + "__dir__", + "__weakref__", + "__module__", + "__annotations__", + "__orig_bases__", + "__parameters__", + "__subclasshook__", + "__init_subclass__", + "__attrs_attrs__", + "__init__", + "__new__", + "__getnewargs__", + "__abstractmethods__", + "__hash__", +]