Skip to content

Commit 6d17ccd

Browse files
committed
dev: Update sphinx and readthedocs config
* Update sphinx config to work with new build backend. * Add explicit Read the Docs configuration file
1 parent 2a6a3e3 commit 6d17ccd

File tree

7 files changed

+21
-19
lines changed

7 files changed

+21
-19
lines changed

.readthedocs.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Read the Docs configuration file for Sphinx projects
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
version: 2
4+
5+
build:
6+
os: ubuntu-22.04
7+
tools:
8+
python: "3.11"
9+
10+
sphinx:
11+
configuration: docs/conf.py
12+
fail_on_warning: true
File renamed without changes.

doc/conf.py renamed to docs/conf.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
3-
43
import datetime
5-
import os
6-
import subprocess
7-
import sys
4+
import importlib.metadata
85

96
import sphinx_rtd_theme
107

11-
if 'check_output' not in dir(subprocess):
12-
import subprocess32 as subprocess
13-
14-
sys.path.insert(0, os.path.abspath('../'))
15-
168
extensions = [
179
'sphinx.ext.autodoc',
1810
'sphinx.ext.intersphinx',
@@ -25,18 +17,15 @@
2517
}
2618

2719
# General information about the project.
28-
root = os.path.join(os.path.dirname(__file__), '..')
29-
setup_script = os.path.join(root, 'setup.py')
30-
fields = ['--name', '--version', '--author']
31-
dist_info_cmd = [sys.executable, setup_script] + fields
32-
output_bytes = subprocess.check_output(dist_info_cmd, cwd=root)
33-
project, version, author = output_bytes.decode('utf-8').strip().split('\n')
20+
metadata = importlib.metadata.metadata("ib3")
21+
project = metadata["name"]
22+
version = metadata["version"]
23+
author = "Bryan Davis"
3424

3525
_origin_date = datetime.date(2017, 2, 19)
3626
_today = datetime.date.today()
3727

38-
copyright = '{_origin_date.year}-{_today.year} {author}'.format(**locals())
39-
28+
copyright = f'{_origin_date.year}-{_today.year} {author} and contributors'
4029
release = version
4130

4231
master_doc = 'index'
File renamed without changes.

doc/index.rst renamed to docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ IRC bot framework using mixins to provide commonly desired functionality.
66
.. image:: https://img.shields.io/pypi/v/ib3.svg
77
:target: https://pypi.org/project/ib3
88

9-
.. image:: https://img.shields.io/github/actions/workflow/status/bd808/python-ib3/tox.yml?logo=github&style=for-the-badge
9+
.. image:: https://img.shields.io/github/actions/workflow/status/bd808/python-ib3/tox.yml?logo=github
1010
:target: https://github.com/bd808/python-ib3/actions/workflows/tox.yml
1111

1212
.. image:: https://readthedocs.org/projects/python-ib3/badge/?version=latest

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ deps=
2020
sphinx
2121
sphinx_rtd_theme
2222
commands=
23-
sphinx-build -q -W -b html -d {envtmpdir}/doctrees doc {envtmpdir}/html
23+
sphinx-build -q -W -b html -d "{envtmpdir}{/}doctree" docs "{toxinidir}{/}dist{/}docs"
24+
python -c 'print(r"documentation available under file://{toxinidir}{/}dist{/}docs{/}index.html")'
2425

2526
[testenv:pkg_meta]
2627
description = check that generated pacakges are valid

0 commit comments

Comments
 (0)