diff --git a/{{cookiecutter.project_slug}}/.gitignore b/{{cookiecutter.project_slug}}/.gitignore
index 36bb668ccb33470e35bf27a3e7ba9e6f216325e2..d5c650e6aee0559e7deb69be50a0dc534473d458 100644
--- a/{{cookiecutter.project_slug}}/.gitignore
+++ b/{{cookiecutter.project_slug}}/.gitignore
@@ -11,6 +11,7 @@ dist
 
 # Documentation
 docs/source/source_documentation
+!docs/source/source_documentation/index.rst
 docs/build
 
 # Setuptools SCM
diff --git a/{{cookiecutter.project_slug}}/docs/cleanup.py b/{{cookiecutter.project_slug}}/docs/cleanup.py
new file mode 100644
index 0000000000000000000000000000000000000000..3a4508d859234544bea35b1008e3c8e4f73d7cc0
--- /dev/null
+++ b/{{cookiecutter.project_slug}}/docs/cleanup.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+
+#  Copyright (C) 2023 ASTRON (Netherlands Institute for Radio Astronomy)
+#  SPDX-License-Identifier: Apache-2.0
+
+import os
+
+file_dir = os.path.dirname(os.path.realpath(__file__))
+
+clean_dir = os.path.join(file_dir, "source", "source_documentation")
+print(f"Cleaning.. {clean_dir}/*")
+
+if not os.path.exists(clean_dir):
+    exit()
+
+for file_name in os.listdir(clean_dir):
+    file = os.path.join(clean_dir, file_name)
+    
+    if file_name == "index.rst":
+        continue
+
+    print(f"Removing.. {file}")
+    os.remove(file)
diff --git a/{{cookiecutter.project_slug}}/docs/cleanup.sh b/{{cookiecutter.project_slug}}/docs/cleanup.sh
deleted file mode 100644
index aac4cef22a134a44b69e99369755a58507b3794f..0000000000000000000000000000000000000000
--- a/{{cookiecutter.project_slug}}/docs/cleanup.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-FILE_DIR=$(dirname -- "$(readlink -f -- "${0}")")
-
-echo "Cleaning.. ${FILE_DIR}/source/source_documentation/*"
-
-for f in "${FILE_DIR}"/source/source_documentation/*
-do
-
-  case $f in
-    */index.rst) true;;
-    *) echo "Removing.. ${f}"; rm "${f}";;
-  esac
-done
diff --git a/{{cookiecutter.project_slug}}/tox.ini b/{{cookiecutter.project_slug}}/tox.ini
index a469b2d888fbfa5bd0d9ab18901b0cfca1f4296a..0fff7afa5ce051721eed1076abb44ca1f5db2531 100644
--- a/{{cookiecutter.project_slug}}/tox.ini
+++ b/{{cookiecutter.project_slug}}/tox.ini
@@ -41,8 +41,6 @@ commands =
     format: {envpython} -m black -v {{cookiecutter.project_slug}} tests
 
 [testenv:docs]
-allowlist_externals =
-    sh
 ; unset LC_ALL / LANGUAGE from testenv, would fail sphinx otherwise
 setenv =
 deps =
@@ -50,7 +48,7 @@ deps =
     -r{toxinidir}/docs/requirements.txt
 changedir = {toxinidir}
 commands =
-    sh docs/cleanup.sh
+    {envpython} docs/cleanup.py
     sphinx-build -b html docs/source docs/build/html
 
 [testenv:build]