diff --git a/docs/examples/tutorial/pure/dostuff.pxd b/docs/examples/tutorial/pure/dostuff.pxd
new file mode 100644
index 0000000000000000000000000000000000000000..f4036323fcaa9572e7cfaffbf3c4ae0edc6bdbdc
--- /dev/null
+++ b/docs/examples/tutorial/pure/dostuff.pxd
@@ -0,0 +1,4 @@
+import cython
+
+@cython.locals(t=cython.int, i=cython.int)
+cpdef int dostuff(int n)
diff --git a/docs/examples/tutorial/pure/dostuff.py b/docs/examples/tutorial/pure/dostuff.py
new file mode 100644
index 0000000000000000000000000000000000000000..748c31b10ed60fc96151151511842c6b04a4f9fe
--- /dev/null
+++ b/docs/examples/tutorial/pure/dostuff.py
@@ -0,0 +1,5 @@
+def dostuff(n):
+    t = 0
+    for i in range(n):
+        t += i
+    return t
diff --git a/docs/src/tutorial/pure.rst b/docs/src/tutorial/pure.rst
index bdce9ba9a0b454b373bad5a5df61f950927ffad5..1c9b586f7fb5491c658c895f52ff484472dd7a74 100644
--- a/docs/src/tutorial/pure.rst
+++ b/docs/src/tutorial/pure.rst
@@ -288,20 +288,13 @@ Magic Attributes within the .pxd
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 The special `cython` module can also be imported and used within the augmenting
-:file:`.pxd` file. For example, the following Python file :file:`dostuff.py`::
+:file:`.pxd` file. For example, the following Python file :file:`dostuff.py`:
 
-    def dostuff(n):
-        t = 0
-        for i in range(n):
-            t += i
-        return t
+.. literalinclude:: ../../examples/tutorial/pure/dostuff.py
 
-can be augmented with the following :file:`.pxd` file :file:`dostuff.pxd`::
+can be augmented with the following :file:`.pxd` file :file:`dostuff.pxd`:
 
-    import cython
-
-    @cython.locals(t = cython.int, i = cython.int)
-    cpdef int dostuff(int n)
+.. literalinclude:: ../../examples/tutorial/pure/dostuff.pxd
 
 The :func:`cython.declare()` function can be used to specify types for global
 variables in the augmenting :file:`.pxd` file.