Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 25 additions & 29 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,48 +15,44 @@ jobs:
# If you change the test matrix, also change it in tox.ini
matrix:
# Test the latest stable Sphinx version on all current Python versions
sphinx: ['4.0']
python: [3.6, 3.7, 3.8, 3.9]
sphinx: ['8.0']
python: ['3.10', '3.11', '3.12', '3.13']
include:
# Also test oldest support Sphinx version for each Python version
# and ensure that we test all major versions of Sphinx too.
# Also test older Sphinx versions on compatible Python versions
# Note: X.0 versions must be quoted as string; Github would otherwise
# set them as "X" (without the ".0"), which is undefined in tox.ini.

# Sphinx 1.4 added support for Python 3.5
- sphinx: 1.4
python: 2.7
- sphinx: 1.4
python: 3.5
- sphinx: '2.0'
python: 3.5
# Sphinx 1.5 added support for Python 3.6
- sphinx: 1.5
python: 3.6
# Sphinx 1.8 added support for Python 3.7 and 3.8
- sphinx: 1.8
python: 2.7
- sphinx: 1.8
python: 3.8
# Sphinx 2.4 added support for Python 3.9
- sphinx: 2.4
python: 3.9
- sphinx: '3.0'
python: 3.9
- sphinx: 3.4
python: 3.9
# Sphinx 5.x supports Python 3.6-3.11
- sphinx: '5.0'
python: '3.10'
- sphinx: '5.0'
python: '3.11'
# Sphinx 6.x supports Python 3.8-3.11
- sphinx: '6.0'
python: '3.10'
- sphinx: '6.0'
python: '3.11'
# Sphinx 7.x supports Python 3.9-3.13
- sphinx: '7.0'
python: '3.10'
- sphinx: '7.0'
python: '3.11'
- sphinx: '7.0'
python: '3.12'
- sphinx: '7.0'
python: '3.13'
name: Python ${{ matrix.python }} - Sphinx ${{ matrix.sphinx }}
steps:
- name: Checkout latest commit
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: Cache pip
uses: actions/cache@v2
uses: actions/cache@v4
id: cache-pip
with:
path: ~/.cache/pip
Expand Down
9 changes: 0 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ extension to automatically generate documentation for use by any rst parser
In itself, the extension is fairly straightforward -- it takes the parsed reST
file from Sphinx_ and outputs it as reST.

Requirements
============

* Sphinx_ 2.0
* Python 3.5

Sphinx 1.4 - 1.8 and Python 2.7 are partly supported. It does work, but some
markup may not parse correctly.

Installing
==========

Expand Down
25 changes: 10 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,12 @@

def get_restbuilder_version():
# load sphinxcontrib.restbuilder from local path.
# (Lots of work, just to get the version info)
from os.path import join, dirname
import sys
import importlib.util
restbuilder_path = join(dirname(__file__), 'sphinxcontrib', 'restbuilder.py')
if sys.version_info >= (3, 5):
# requires Python 3.5 or up.
import importlib.util
spec = importlib.util.spec_from_file_location('sphinxcontrib.restbuilder', restbuilder_path)
restbuilder = importlib.util.module_from_spec(spec)
spec.loader.exec_module(restbuilder)
else:
# Python 2.7 support
import imp
restbuilder = imp.load_source('sphinxcontrib.restbuilder', restbuilder_path)
spec = importlib.util.spec_from_file_location('sphinxcontrib.restbuilder', restbuilder_path)
restbuilder = importlib.util.module_from_spec(spec)
spec.loader.exec_module(restbuilder)
return restbuilder.__version__

long_desc = '''
Expand All @@ -34,7 +26,7 @@ def get_restbuilder_version():
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
'''

requires = ['Sphinx>=1.4', 'docutils']
requires = ['Sphinx>=5.0', 'docutils']

setup(
name='sphinxcontrib-restbuilder',
Expand All @@ -54,14 +46,17 @@ def get_restbuilder_version():
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Topic :: Documentation :: Sphinx',
'Topic :: Software Development :: Documentation',
'Topic :: Text Processing :: Markup :: reStructuredText',
],
platforms='any',
python_requires='>=2.7, !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*',
python_requires='>=3.10',
packages=find_packages(exclude=['tests']),
include_package_data=True,
install_requires=requires,
Expand Down
10 changes: 10 additions & 0 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,23 @@ def build_sphinx(src_dir, output_dir, files=None, config={}):
app.build(force_all=force_all, filenames=filenames)


def normalize_version_text(text):
"""
Normalize version directive text for comparison across Sphinx versions.
Sphinx 7.3+ changed "New in version" to "Added in version".
"""
return text.replace('Added in version', 'New in version')


def assert_node_equal(output, expected):
assert type(output) == type(expected)
if isinstance(output, Text):
output_text = output.replace('\r\n', ' ')
output_text = output_text.replace('\n', ' ')
output_text = normalize_version_text(output_text)
expected_text = expected.replace('\r\n', ' ')
expected_text = expected_text.replace('\n', ' ')
expected_text = normalize_version_text(expected_text)
assert output_text == expected_text
elif isinstance(output, system_message):
assert len(output.children) == len(expected.children)
Expand Down
43 changes: 12 additions & 31 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,43 +1,24 @@
[tox]
; If you change the test matrix, also change it in .github/workflows/tests.yml
envlist =
python2.7-sphinx{1.4,1.8} # Supported by Sphinx 1.0-1.8
python3.5-sphinx{1.4,2.0,3.4} # Supported by Sphinx 1.4-3.4
python3.6-sphinx{1.5,4.0} # Supported by Sphinx 1.5-4.x
python3.7-sphinx{4.0} # Supported by Sphinx 1.8-4.x
python3.8-sphinx{1.8,4.0} # Supported by Sphinx 1.8-4.x
python3.9-sphinx{2.4,3.0,3.4,4.0} # Supported by Sphinx 2.4-4.x
python3.10-sphinx{5.0,6.0,7.0,8.0}
python3.11-sphinx{5.0,6.0,7.0,8.0}
python3.12-sphinx{7.0,8.0}
python3.13-sphinx{8.0}

[testenv]
basepython =
python2.7: python2.7
python3.5: python3.5
python3.6: python3.6
python3.7: python3.7
python3.8: python3.8
python3.9: python3.9
python3.10: python3.10
python3.11: python3.11
python3.12: python3.12
python3.13: python3.13

deps =
pytest
sphinx1.4: Sphinx >= 1.4, < 1.5 # Supports Python 2.6, 2.7, 3.3, 3.4, 3.5
sphinx1.5: Sphinx >= 1.5, < 1.6 # Supports Python 2.7, 3.4, 3.5
sphinx1.6: Sphinx >= 1.6, < 1.7 # Supports Python 2.7, 3.4, 3.5, 3.6
sphinx1.7: Sphinx >= 1.7, < 1.8 # Supports Python 2.7, 3.4, 3.5, 3.6
sphinx1.8: Sphinx >= 1.8, < 2.0 # Supports Python 2.7, 3.4, 3.5, 3.6, 3.7, 3.8
sphinx2.0: Sphinx >= 2.0, < 2.1 # Supports Python 3.4, 3.5, 3.6, 3.7, 3.8
sphinx2.1: Sphinx >= 2.1, < 2.2 # Supports Python 3.5, 3.6, 3.7, 3.8
sphinx2.2: Sphinx >= 2.2, < 2.3 # Supports Python 3.5, 3.6, 3.7, 3.8
sphinx2.3: Sphinx >= 2.3, < 2.4 # Supports Python 3.5, 3.6, 3.7, 3.8
sphinx2.4: Sphinx >= 2.4, < 3.0 # Supports Python 3.5, 3.6, 3.7, 3.8, 3.9
sphinx3.0: Sphinx >= 3.0, < 3.1 # Supports Python 3.5, 3.6, 3.7, 3.8, 3.9
sphinx3.4: Sphinx >= 3.4, < 3.5 # Supports Python 3.5, 3.6, 3.7, 3.8, 3.9
sphinx3.5: Sphinx >= 3.5, < 3.6 # Supports Python 3.5, 3.6, 3.7, 3.8, 3.9
sphinx4.0: Sphinx >= 4.0, < 4.1 # Supports Python 3.6, 3.7, 3.8, 3.9
sphinx5.0: Sphinx >= 5.0, < 6.0 # Supports Python 3.6-3.11
sphinx6.0: Sphinx >= 6.0, < 7.0 # Supports Python 3.8-3.11
sphinx7.0: Sphinx >= 7.0, < 8.0 # Supports Python 3.9-3.13
sphinx8.0: Sphinx >= 8.0, < 9.0 # Supports Python 3.10-3.13

commands =
pytest -v

[pytest]
filterwarnings =
; suppress FutureWarning in Sphinx 1.0...2.2 about Node.traverse()
ignore::FutureWarning:sphinx.util.nodes