docs/build_docs.py
"""Cleanup all artifacts generated by previous builds."""
        api_dir = os.path.join(self._src_dir, "_api")
        shutil.rmtree(api_dir, ignore_errors=True)
        shutil.rmtree(self._out_dir, ignore_errors=True)
        os.makedirs(api_dir, exist_ok=True)
        os.makedirs(self._out_dir, exist_ok=True)
        print(f"Recreated content of the {shlex.quote(self._out_dir)} and {shlex.quote(api_dir)} folders")
    def check_spelling(self):
        """Checks spelling."""
        spelling_errors = []
        with TemporaryDirectory() as tmp_dir, with_group(f"Check spelling: {self.package_name}"):
            build_cmd = [
                "sphinx-build",
                "-W",  
                "-T",  
                "-b",  
                "spelling",
                "-c",
                DOCS_DIR,
                "-d",  
                self._doctree_dir,
                self._src_dir,  
                tmp_dir,
            ]
            print("Executing cmd: ", " ".join([shlex.quote(c) for c in build_cmd]))
            env = os.environ.copy()
            env['AIRFLOW_PACKAGE_NAME'] = self.package_name
            completed_proc = run(  
                build_cmd, cwd=self._src_dir, env=env