Add (now mandatory) `.readthedocs.yaml` file, add docs `requirements.txt` and update sphinx conf (#684)

This commit is contained in:
Mirko Galimberti 2023-10-10 08:50:53 +02:00 committed by GitHub
parent 1d73253ac9
commit c144e968cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 6 deletions

16
.readthedocs.yaml Normal file
View File

@ -0,0 +1,16 @@
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
version: 2
build:
os: ubuntu-22.04
tools:
python: "3"
python:
install:
- requirements: docs/requirements.txt
sphinx:
configuration: docs/source/conf.py

2
docs/requirements.txt Normal file
View File

@ -0,0 +1,2 @@
Sphinx~=7.2.6
furo==2023.9.10

View File

@ -11,7 +11,9 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
import sys, os
import datetime
import os
import re
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@ -40,17 +42,34 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'Pyjnius'
copyright = u'2017, Kivy Team and other contributors'
project = 'pyjnius'
_today = datetime.datetime.now()
copyright = f'{_today.year}, Kivy Team and other contributors'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# Lookup the version from the pyjnius module, without installing it
# since readthedocs.org may have issue to install it.
# Read the version from the __init__.py file, without importing it.
def get_version():
with open(
os.path.join(os.path.abspath("../.."), "jnius", "__init__.py")
) as fp:
for line in fp:
m = re.search(r'^\s*__version__\s*=\s*([\'"])([^\'"]+)\1\s*$', line)
if m:
return m.group(2)
# The short X.Y version.
version = '1.0'
version = get_version()
# The full version, including alpha/beta/rc tags.
release = '1.0a1'
release = get_version()
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
@ -91,7 +110,7 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'default'
html_theme = 'furo'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the