2.7 KiB
Maintainer Guide
This page summarizes how the API, CLI, and documentation site are wired together.
Public API boundary
The stable Python API is exported from:
co_op_translator.api
Currently, that package exports:
from co_op_translator.api import run_translation
When adding new public APIs, update:
src/co_op_translator/api/__init__.pydocs/api.mdtests/co_op_translator/test_api.py
Avoid documenting lower-level core modules as stable API unless the project intends to support them directly.
CLI entry points
The package defines these Poetry scripts:
[tool.poetry.scripts]
translate = "co_op_translator.__main__:main"
evaluate = "co_op_translator.__main__:main"
migrate-links = "co_op_translator.__main__:main"
src/co_op_translator/__main__.py dispatches by script name:
translatecallsco_op_translator.cli.translate.translate_commandevaluatecallsco_op_translator.cli.evaluate.evaluate_commandmigrate-linkscallsco_op_translator.cli.migrate_links.migrate_links_command
When adding or changing CLI options, update:
- the relevant
src/co_op_translator/cli/*.pycommand getting_started/command-reference.mddocs/cli.md- CLI-related tests, if behavior changes
Translation flow
The high-level translation flow is:
- Parse CLI arguments or API parameters.
- Validate LLM configuration with
LLMConfig. - Validate Azure AI Vision when image translation is selected.
- Normalize language codes.
- Detect legacy language folder aliases.
- Estimate translation volume.
- Update README language/course sections when applicable.
- Delegate project translation to
ProjectTranslator. ProjectTranslatordelegates file processing toTranslationManager.
Documentation site
The docs site is configured by:
mkdocs.yml
requirements-docs.txt
docs/
Build locally:
python -m pip install -r requirements-docs.txt
python -m mkdocs build --strict
Preview locally:
python -m mkdocs serve
The generated site is written to site/, which is ignored by git.
GitHub Pages workflow
.github/workflows/docs.yml builds the site on pull requests and deploys it on pushes to main.
The workflow installs:
pip install -r requirements.txt
pip install -r requirements-docs.txt
Installing runtime dependencies before docs dependencies lets mkdocstrings import the package and render the public Python API reference.
Docs quality bar
Before merging documentation changes, run:
python -m mkdocs build --strict
git diff --check
Use strict builds so broken links, invalid navigation entries, and API rendering issues fail early.