build_lang() — fastapi Function Reference
Architecture documentation for the build_lang() function in docs.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD 8c9524ad_0b65_9164_d276_a1c8791cb295["build_lang()"] 089911a1_02c3_0f6b_d62d_71c980ade67e["docs.py"] 8c9524ad_0b65_9164_d276_a1c8791cb295 -->|defined in| 089911a1_02c3_0f6b_d62d_71c980ade67e 7a817bd6_0a4c_302b_47a6_6d0a82232601["build_all()"] 8c9524ad_0b65_9164_d276_a1c8791cb295 -->|calls| 7a817bd6_0a4c_302b_47a6_6d0a82232601 style 8c9524ad_0b65_9164_d276_a1c8791cb295 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
scripts/docs.py lines 145–175
def build_lang(
lang: str = typer.Argument(
..., callback=lang_callback, autocompletion=complete_existing_lang
),
) -> None:
"""
Build the docs for a language.
"""
lang_path: Path = Path("docs") / lang
if not lang_path.is_dir():
typer.echo(f"The language translation doesn't seem to exist yet: {lang}")
raise typer.Abort()
typer.echo(f"Building docs for: {lang}")
build_site_dist_path = build_site_path / lang
if lang == "en":
dist_path = site_path
# Don't remove en dist_path as it might already contain other languages.
# When running build_all(), that function already removes site_path.
# All this is only relevant locally, on GitHub Actions all this is done through
# artifacts and multiple workflows, so it doesn't matter if directories are
# removed or not.
else:
dist_path = site_path / lang
shutil.rmtree(dist_path, ignore_errors=True)
current_dir = os.getcwd()
os.chdir(lang_path)
shutil.rmtree(build_site_dist_path, ignore_errors=True)
subprocess.run(["mkdocs", "build", "--site-dir", build_site_dist_path], check=True)
shutil.copytree(build_site_dist_path, dist_path, dirs_exist_ok=True)
os.chdir(current_dir)
typer.secho(f"Successfully built docs for: {lang}", color=typer.colors.GREEN)
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does build_lang() do?
build_lang() is a function in the fastapi codebase, defined in scripts/docs.py.
Where is build_lang() defined?
build_lang() is defined in scripts/docs.py at line 145.
What does build_lang() call?
build_lang() calls 1 function(s): build_all.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free