diff --git a/.readthedocs.yml b/.readthedocs.yml index cac0803..065a268 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,15 +1,25 @@ +# Read the Docs configuration file for Sphinx projects +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required version: 2 +# Set the OS, Python version and other tools you might need build: - image: latest + os: ubuntu-22.04 + tools: + python: "3.12" python: - version: 3.8 install: - method: pip path: . extra_requirements: - docs - - test formats: [] + +# Build documentation in the "docs/" directory with Sphinx +sphinx: + builder: html + configuration: docs/conf.py \ No newline at end of file diff --git a/README.rst b/README.rst index 4ab5e1f..709ab5a 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,4 @@ -.. image:: https://github.com/alexbinks/tessilator/blob/main/gif/lc_movie.gif +.. image:: https://github.com/alexbinks/tessilator/blob/main/docs/_static/lc_movie.gif :width: 500 px :align: center :alt: "AB Doradus TESS periods" diff --git a/gif/lc_movie.gif b/docs/_static/lc_movie.gif similarity index 100% rename from gif/lc_movie.gif rename to docs/_static/lc_movie.gif diff --git a/docs/conf.py b/docs/conf.py index c32a60e..6dd2c37 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -12,8 +12,10 @@ import datetime from importlib import import_module -import os import sys +import tomllib +from pathlib import Path + extensions = ['sphinx_automodapi.automodapi', 'sphinx.ext.intersphinx' @@ -33,20 +35,16 @@ templates_path = ['_templates'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] -# Get configuration information from setup.cfg -from configparser import ConfigParser -conf = ConfigParser() - -conf.read([os.path.join(os.path.dirname(__file__), '..', 'setup.cfg')]) -setup_cfg = dict(conf.items('metadata')) +# Get configuration information from pyproject.toml +with (Path(__file__).parents[1] / "pyproject.toml").open("rb") as f: + pyproject = tomllib.load(f) -project = setup_cfg['name'] -author = setup_cfg['author'] -copyright = '{0}, {1}'.format( - datetime.datetime.now().year, setup_cfg['author']) +project = pyproject["project"]["name"] +author = ",".join([l["name"] for l in pyproject["project"]["authors"]]) +copyright = "{0}, {1}".format(datetime.datetime.now().year, author) -import_module(setup_cfg['name']) -package = sys.modules[setup_cfg['name']] +import_module(pyproject["project"]["name"]) +package = sys.modules[pyproject["project"]["name"]] # The short X.Y version. version = package.__version__.split('-', 1)[0] @@ -58,7 +56,7 @@ # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output html_theme = 'pyramid' -#html_static_path = ["_static"] +html_static_path = ["_static"] html_sidebars = { '**': [ 'globaltoc.html', diff --git a/docs/index.rst b/docs/index.rst index e4a5b2c..bbacbd8 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,7 +3,7 @@ You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -.. image:: ../gif/lc_movie.gif +.. image:: _static/lc_movie.gif :width: 800 :align: center diff --git a/pyproject.toml b/pyproject.toml index fbb709d..c317364 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,11 +40,11 @@ dependencies = [ [project.optional-dependencies] test = [ "pytest-astropy", - "sphinx-astropy" ] docs = [ "sphinx", "sphinx-automodapi", + "sphinx-astropy", "numpydoc" ]