Skip to content

Commit f2cd00d

Browse files
mosc9575DLWoodruff
andauthored
add sphinx-copybutton extension to documentation (#579)
* add sphinx-copybutton extension to documentation * add sphinx-copybutton to the test yaml --------- Co-authored-by: Dave Woodruff <david.l.woodruff@gmail.com>
1 parent f60304a commit f2cd00d

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

.github/workflows/test_pr_and_main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
- name: Install dependencies
6464
run: |
6565
conda install mpi4py pandas setuptools
66-
pip install pyomo sphinx sphinx_rtd_theme dill gridx-egret cplex pybind11
66+
pip install pyomo sphinx sphinx_rtd_theme sphinx-copybutton dill gridx-egret cplex pybind11
6767
pip install xpress
6868
6969
- name: Build pyomo extensions

doc/src/conf.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,23 @@
4242
# Add any Sphinx extension module names here, as strings. They can be
4343
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
4444
# ones.
45-
extensions = ['sphinx.ext.autodoc',
46-
'sphinx.ext.coverage',
47-
'sphinx.ext.mathjax',
48-
'sphinx.ext.viewcode',
49-
'sphinx.ext.napoleon',
50-
'sphinx.ext.ifconfig',
51-
'sphinx.ext.inheritance_diagram',
52-
'sphinx.ext.autosummary',
53-
'sphinx.ext.doctest']
54-
#'sphinx.ext.githubpages']
45+
extensions = [
46+
"sphinx.ext.autodoc",
47+
"sphinx.ext.coverage",
48+
"sphinx.ext.mathjax",
49+
"sphinx.ext.viewcode",
50+
"sphinx.ext.napoleon",
51+
"sphinx.ext.ifconfig",
52+
"sphinx.ext.inheritance_diagram",
53+
"sphinx.ext.autosummary",
54+
"sphinx.ext.doctest",
55+
#'sphinx.ext.githubpages',
56+
"sphinx_copybutton",
57+
]
58+
59+
# allow the sphinx-copybutton to remove prompt text
60+
copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: "
61+
copybutton_prompt_is_regexp = True
5562

5663
viewcode_import = True
5764
#napoleon_include_private_with_doc = True

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ tracker = "https://github.com/Pyomo/mpi-sppy/issues"
3838

3939
[project.optional-dependencies]
4040
doc = [
41-
"sphinx_rtd_theme",
4241
"sphinx",
42+
"sphinx-copybutton",
43+
"sphinx_rtd_theme",
4344
]
4445
mpi = [
4546
"mpi4py>=3.0.3"

0 commit comments

Comments
 (0)