From 6ea5d17816a6706f19fb234d663e8856f116a723 Mon Sep 17 00:00:00 2001 From: Sebastien Morais Date: Mon, 6 Nov 2023 23:20:36 +0100 Subject: [PATCH] CI: fix upload error in full documentation Problem Building the full documentation with sphynx leads to the generation of a .doctree directory. This directory is composed of a file environment.pickle which has size > 100 Mb. Thus, the upload step of the full documentation workflow fails due to the size of such file (git does not allow files of > 100 Mb without using lfs). Solution Since the .doctree directory should not be versioned at all, we had a build-finished event to delete to .doctree directory after the documentation build. --- doc/source/conf.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/source/conf.py b/doc/source/conf.py index 02f4d12852b..864471ad0ff 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -21,6 +21,7 @@ from docutils.parsers.rst import Directive from docutils import nodes from sphinx import addnodes +import shutil # <-----------------Override the sphinx pdf builder----------------> # Some pages do not render properly as per the expected Sphinx LaTeX PDF signature. @@ -70,9 +71,16 @@ def autodoc_skip_member(app, what, name, obj, skip, options): # return True if exclude else None +def remove_doctree(app, exception): + """Remove the .doctree directory created during the documentation build. + """ + shutil.rmtree(app.doctreedir) + + def setup(app): app.add_directive('pprint', PrettyPrintDirective) app.connect('autodoc-skip-member', autodoc_skip_member) + app.connect('build-finished', remove_doctree) local_path = os.path.dirname(os.path.realpath(__file__))