def perform_docs_build_for_single_package(build_specification: BuildSpecification) -> BuildDocsResult: """Performs single package docs build.""" builder = AirflowDocsBuilder( package_name=build_specification.package_name, for_production=build_specification.for_production ) console.print(f"[blue]{build_specification.package_name:60}:[/] Building documentation") result = BuildDocsResult( package_name=build_specification.package_name, errors=builder.build_sphinx_docs( verbose=build_specification.verbose, ), log_file_name=builder.log_build_filename, ) return result
def build_docs_for_packages( current_packages: List[str], docs_only: bool, spellcheck_only: bool, for_production: bool, jobs: int, verbose: bool, ) -> Tuple[Dict[str, List[DocBuildError]], Dict[str, List[SpellingError]]]: """Builds documentation for all packages and combines errors.""" all_build_errors: Dict[str, List[DocBuildError]] = defaultdict(list) all_spelling_errors: Dict[str, List[SpellingError]] = defaultdict(list) with with_group("Cleaning documentation files"): for package_name in current_packages: console.print(f"[blue]{package_name:60}:[/] Cleaning files") builder = AirflowDocsBuilder(package_name=package_name, for_production=for_production) builder.clean_files() if jobs > 1: if os.getenv('CI', '') == '': console.print( "[yellow] PARALLEL DOCKERIZED EXECUTION REQUIRES IMAGE TO BE BUILD BEFORE !!!![/]" ) console.print( "[yellow] Make sure that you've build the image before runnning docs build.[/]" ) console.print( "[yellow] otherwise local changes you've done will not be used during the check[/]" ) console.print() run_in_parallel( all_build_errors, all_spelling_errors, current_packages, docs_only, for_production, jobs, spellcheck_only, verbose, ) else: run_sequentially( all_build_errors, all_spelling_errors, current_packages, docs_only, for_production, spellcheck_only, verbose, ) return all_build_errors, all_spelling_errors
def perform_spell_check_for_single_package(build_specification: BuildSpecification) -> SpellCheckResult: """Performs single package spell check.""" builder = AirflowDocsBuilder( package_name=build_specification.package_name, for_production=build_specification.for_production ) console.print(f"[blue]{build_specification.package_name:60}:[/] Checking spelling started") result = SpellCheckResult( package_name=build_specification.package_name, errors=builder.check_spelling( verbose=build_specification.verbose, ), log_file_name=builder.log_spelling_filename, ) console.print(f"[blue]{build_specification.package_name:60}:[/] Checking spelling completed") return result
def main(): """Main code""" args = _get_parser().parse_args() available_packages = get_available_packages() package_filters = args.package_filter current_packages = process_package_filters(available_packages, package_filters) print(f"Publishing docs for {len(current_packages)} package(s)") for pkg in current_packages: print(f" - {pkg}") print() for package_name in current_packages: builder = AirflowDocsBuilder(package_name=package_name, for_production=True) builder.publish(override_versioned=args.override_versioned)
def main(): """Main code""" args = _get_parser().parse_args() available_packages = get_available_packages() package_filters = args.package_filter current_packages = ( [p for p in available_packages if any(fnmatch.fnmatch(p, f) for f in package_filters)] if package_filters else available_packages ) print(f"Publishing docs for {len(current_packages)} package(s)") for pkg in current_packages: print(f" - {pkg}") print() for package_name in current_packages: builder = AirflowDocsBuilder(package_name=package_name, for_production=True) builder.publish()
def build_docs_for_packages( current_packages: List[str], docs_only: bool, spellcheck_only: bool, for_production: bool, verbose: bool ) -> Tuple[Dict[str, List[DocBuildError]], Dict[str, List[SpellingError]]]: """Builds documentation for single package and returns errors""" all_build_errors: Dict[str, List[DocBuildError]] = defaultdict(list) all_spelling_errors: Dict[str, List[SpellingError]] = defaultdict(list) for package_no, package_name in enumerate(current_packages, start=1): print("#" * 20, f"[{package_no}/{len(current_packages)}] {package_name}", "#" * 20) builder = AirflowDocsBuilder(package_name=package_name, for_production=for_production, verbose=verbose) builder.clean_files() if not docs_only: with with_group(f"Check spelling: {package_name}"): spelling_errors = builder.check_spelling() if spelling_errors: all_spelling_errors[package_name].extend(spelling_errors) if not spellcheck_only: with with_group(f"Building docs: {package_name}"): docs_errors = builder.build_sphinx_docs() if docs_errors: all_build_errors[package_name].extend(docs_errors) return all_build_errors, all_spelling_errors
def build_docs_for_packages( current_packages: List[str], docs_only: bool, spellcheck_only: bool, for_production: bool, jobs: int, verbose: bool, ) -> Tuple[Dict[str, List[DocBuildError]], Dict[str, List[SpellingError]]]: """Builds documentation for all packages and combines errors.""" all_build_errors: Dict[str, List[DocBuildError]] = defaultdict(list) all_spelling_errors: Dict[str, List[SpellingError]] = defaultdict(list) with with_group("Cleaning documentation files"): for package_name in current_packages: console.print(f"[blue]{package_name:60}:[/] Cleaning files") builder = AirflowDocsBuilder(package_name=package_name, for_production=for_production) builder.clean_files() if jobs > 1: run_in_parallel( all_build_errors, all_spelling_errors, current_packages, docs_only, for_production, jobs, spellcheck_only, verbose, ) else: run_sequentially( all_build_errors, all_spelling_errors, current_packages, docs_only, for_production, spellcheck_only, verbose, ) return all_build_errors, all_spelling_errors
def build_docs_for_packages( current_packages: List[str], docs_only: bool, spellcheck_only: bool, for_production: bool ) -> Tuple[Dict[str, List[DocBuildError]], Dict[str, List[SpellingError]]]: """Builds documentation for single package and returns errors""" all_build_errors: Dict[str, List[DocBuildError]] = defaultdict(list) all_spelling_errors: Dict[str, List[SpellingError]] = defaultdict(list) for package_name in current_packages: print("#" * 20, package_name, "#" * 20) builder = AirflowDocsBuilder(package_name=package_name, for_production=for_production) builder.clean_files() if not docs_only: spelling_errors = builder.check_spelling() if spelling_errors: all_spelling_errors[package_name].extend(spelling_errors) if not spellcheck_only: docs_errors = builder.build_sphinx_docs() if docs_errors: all_build_errors[package_name].extend(docs_errors) return all_build_errors, all_spelling_errors