Skip to content

Commit ec419f2

Browse files
authoredOct 20, 2023
Add (now mandatory) .readthedocs.yaml file, add docs requirements.txt and update sphinx conf (#103)
1 parent dd771b0 commit ec419f2

File tree

3 files changed

+42
-6
lines changed

3 files changed

+42
-6
lines changed
 

‎.readthedocs.yaml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Read the Docs configuration file for Sphinx projects
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
version: 2
5+
6+
build:
7+
os: ubuntu-22.04
8+
tools:
9+
python: "3"
10+
11+
python:
12+
install:
13+
- requirements: docs/requirements.txt
14+
15+
sphinx:
16+
configuration: docs/source/conf.py

‎docs/requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Sphinx~=7.2.6
2+
furo==2023.9.10

‎docs/source/conf.py

+24-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
# All configuration values have a default; values that are commented out
1212
# serve to show the default.
1313

14-
import sys, os
14+
import datetime
15+
import os
16+
import re
1517

1618
# If extensions (or modules to document with autodoc) are in another directory,
1719
# add these directories to sys.path here. If the directory is relative to the
@@ -40,17 +42,33 @@
4042
master_doc = 'index'
4143

4244
# General information about the project.
43-
project = u'Pyobjus'
44-
copyright = u'2012, Mathieu Virbel, Gabriel Pettier'
45+
project = 'pyobjus'
46+
47+
_today = datetime.datetime.now()
48+
49+
copyright = f'{_today.year}, Mathieu Virbel, Gabriel Pettier'
4550

4651
# The version info for the project you're documenting, acts as replacement for
4752
# |version| and |release|, also used in various other places throughout the
4853
# built documents.
4954
#
55+
56+
# Lookup the version from the pyobjus module, without installing it
57+
# since readthedocs.org may have issue to install it.
58+
# Read the version from the __init__.py file, without importing it.
59+
def get_version():
60+
with open(
61+
os.path.join(os.path.abspath("../.."), "pyobjus", "__init__.py")
62+
) as fp:
63+
for line in fp:
64+
m = re.search(r'^\s*__version__\s*=\s*([\'"])([^\'"]+)\1\s*$', line)
65+
if m:
66+
return m.group(2)
67+
5068
# The short X.Y version.
51-
version = '1.0'
69+
version = get_version()
5270
# The full version, including alpha/beta/rc tags.
53-
release = '1.0a1'
71+
release = get_version()
5472

5573
# The language for content autogenerated by Sphinx. Refer to documentation
5674
# for a list of supported languages.
@@ -91,7 +109,7 @@
91109

92110
# The theme to use for HTML and HTML Help pages. See the documentation for
93111
# a list of builtin themes.
94-
html_theme = 'default'
112+
html_theme = 'furo'
95113

96114
# Theme options are theme-specific and customize the look and feel of a theme
97115
# further. For a list of options available for each theme, see the

0 commit comments

Comments
 (0)
Please sign in to comment.