Skip to content

Commit

Permalink
Merge pull request #25 from hamogu/sphinx
Browse files Browse the repository at this point in the history
Make sphinx build again
  • Loading branch information
alexbinks authored May 24, 2024
2 parents 66e5c1b + 1cdadc8 commit b27ee45
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 20 deletions.
16 changes: 13 additions & 3 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
File renamed without changes
26 changes: 12 additions & 14 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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]
Expand All @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ dependencies = [
[project.optional-dependencies]
test = [
"pytest-astropy",
"sphinx-astropy"
]
docs = [
"sphinx",
"sphinx-automodapi",
"sphinx-astropy",
"numpydoc"
]

Expand Down

0 comments on commit b27ee45

Please sign in to comment.