From 214cd996fc59c5936ffff915a6f4044a18d5316b Mon Sep 17 00:00:00 2001 From: Joshua Bronson Date: Thu, 4 Nov 2021 21:30:54 +0000 Subject: [PATCH] Add sphinx-copybutton, fix readthedocs setup --- .readthedocs.yml | 14 ++++++++------ docs/conf.py | 4 ++++ requirements/dev.txt | 10 +++++----- requirements/docs.in | 1 + requirements/docs.txt | 6 +++++- requirements/lint.txt | 6 +----- requirements/tests.txt | 6 +++++- 7 files changed, 29 insertions(+), 18 deletions(-) diff --git a/.readthedocs.yml b/.readthedocs.yml index 4b055be..604a6a5 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -1,3 +1,4 @@ +--- # https://docs.readthedocs.io/en/latest/config-file/ version: 2 @@ -5,12 +6,13 @@ formats: - htmlzip build: - image: latest + os: "ubuntu-20.04" + tools: + python: "3.10" + +sphinx: + configuration: docs/conf.py python: - version: 3.8 install: - - method: pip - path: . - extra_requirements: - - docs + - requirements: requirements/docs.txt diff --git a/docs/conf.py b/docs/conf.py index 44f5f1e..710d1ab 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -41,6 +41,7 @@ suppress_warnings = ['image.nonlocal_uri'] # extensions coming with Sphinx (named 'sphinx.ext.*') or custom ones. extensions = [ 'alabaster', + 'sphinx_copybutton', 'sphinx.ext.autodoc', 'sphinx.ext.autosectionlabel', 'sphinx.ext.coverage', @@ -325,6 +326,9 @@ autodoc_typehints = 'description' doctest_global_setup = """ """ +# https://sphinx-copybutton.readthedocs.io/en/latest/#strip-and-configure-input-prompts-for-code-cells +copybutton_prompt_text = '>>> ' + def setup(app): """https://docs.readthedocs.io/en/latest/guides/adding-custom-css.html#adding-custom-css-or-javascript-to-a-sphinx-project""" diff --git a/requirements/dev.txt b/requirements/dev.txt index 89d2ec4..97c4eef 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.9 +# This file is autogenerated by pip-compile with python 3.10 # To update, run: # # pip-compile dev.in @@ -138,6 +138,10 @@ sortedcontainers==2.4.0 # hypothesis # sortedcollections sphinx==4.2.0 + # via + # -r docs.in + # sphinx-copybutton +sphinx-copybutton==0.4.0 # via -r docs.in sphinxcontrib-applehelp==1.0.2 # via sphinx @@ -165,10 +169,6 @@ tomli==1.2.2 # pep517 tox==3.24.4 # via -r dev.in -typing-extensions==3.10.0.2 - # via - # astroid - # pylint urllib3==1.26.7 # via requests virtualenv==20.10.0 diff --git a/requirements/docs.in b/requirements/docs.in index 6966869..0e7bfdf 100644 --- a/requirements/docs.in +++ b/requirements/docs.in @@ -1 +1,2 @@ sphinx +sphinx-copybutton diff --git a/requirements/docs.txt b/requirements/docs.txt index 7f45bca..e1833d4 100644 --- a/requirements/docs.txt +++ b/requirements/docs.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.9 +# This file is autogenerated by pip-compile with python 3.10 # To update, run: # # pip-compile docs.in @@ -35,6 +35,10 @@ requests==2.26.0 snowballstemmer==2.1.0 # via sphinx sphinx==4.2.0 + # via + # -r docs.in + # sphinx-copybutton +sphinx-copybutton==0.4.0 # via -r docs.in sphinxcontrib-applehelp==1.0.2 # via sphinx diff --git a/requirements/lint.txt b/requirements/lint.txt index bfb9b1a..9007b43 100644 --- a/requirements/lint.txt +++ b/requirements/lint.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.9 +# This file is autogenerated by pip-compile with python 3.10 # To update, run: # # pip-compile lint.in @@ -61,10 +61,6 @@ toml==0.10.2 # pre-commit # pylint # pytest -typing-extensions==3.10.0.2 - # via - # astroid - # pylint virtualenv==20.10.0 # via pre-commit wrapt==1.13.3 diff --git a/requirements/tests.txt b/requirements/tests.txt index 381c03a..2146369 100644 --- a/requirements/tests.txt +++ b/requirements/tests.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with python 3.9 +# This file is autogenerated by pip-compile with python 3.10 # To update, run: # # pip-compile tests.in @@ -80,6 +80,10 @@ sortedcontainers==2.4.0 # hypothesis # sortedcollections sphinx==4.2.0 + # via + # -r docs.in + # sphinx-copybutton +sphinx-copybutton==0.4.0 # via -r docs.in sphinxcontrib-applehelp==1.0.2 # via sphinx