diff --git a/Doc/conf.py b/Doc/conf.py
index bd01850589b273..a08a92f85e6cf1 100644
--- a/Doc/conf.py
+++ b/Doc/conf.py
@@ -22,6 +22,7 @@
'pyspecific',
'sphinx.ext.coverage',
'sphinx.ext.doctest',
+ 'sphinx_copybutton',
]
# Skip if downstream redistributors haven't installed it
@@ -379,3 +380,5 @@
'',
'',
]
+
+copybutton_exclude = '.linenos, .gp, .go'
diff --git a/Doc/requirements-oldest-sphinx.txt b/Doc/requirements-oldest-sphinx.txt
index f7e0665bde445d..304fd9201da244 100644
--- a/Doc/requirements-oldest-sphinx.txt
+++ b/Doc/requirements-oldest-sphinx.txt
@@ -36,3 +36,4 @@ sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
urllib3==1.26.15
+sphinx-copybutton<0.6
diff --git a/Doc/requirements.txt b/Doc/requirements.txt
index bde509febf5bde..9aa4c952c456d5 100644
--- a/Doc/requirements.txt
+++ b/Doc/requirements.txt
@@ -12,6 +12,7 @@ sphinx==6.2.0
blurb
sphinxext-opengraph==0.7.5
+sphinx-copybutton<0.6
# The theme used by the documentation is stored separately, so we need
# to install that as well.
diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst
index 1d34d8a0fa463c..1bf8f37c75a208 100644
--- a/Doc/whatsnew/3.13.rst
+++ b/Doc/whatsnew/3.13.rst
@@ -1057,3 +1057,10 @@ removed, although there is currently no date scheduled for their removal.
* :c:func:`PyThread_get_key_value`: use :c:func:`PyThread_tss_get`.
* :c:func:`PyThread_delete_key_value`: use :c:func:`PyThread_tss_delete`.
* :c:func:`PyThread_ReInitTLS`: no longer needed.
+
+
+Documentation
+=============
+
+* :gh:`107024` -- added ``sphinx-copybutton`` to docs dependencies. Now one can copy contents of ``code-block`` with
+ just a click of a button.
diff --git a/Misc/NEWS.d/next/Documentation/2023-07-23-13-13-52.gh-issue-107024.6KKp9L.rst b/Misc/NEWS.d/next/Documentation/2023-07-23-13-13-52.gh-issue-107024.6KKp9L.rst
new file mode 100644
index 00000000000000..6333f079249b4b
--- /dev/null
+++ b/Misc/NEWS.d/next/Documentation/2023-07-23-13-13-52.gh-issue-107024.6KKp9L.rst
@@ -0,0 +1 @@
+Added copy button to code snippets in documentation