Skip to content

docs: add quickstart and concepts pages with drift-proof code blocks - #56

Merged
wenh06 merged 1 commit into
masterfrom
docs-tutorials-a
Oct 26, 2026
Merged

wenh06 merged 1 commit into
masterfrom
docs-tutorials-a

Conversation

@wenh06

@wenh06 wenh06 commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add a Quickstart page (docs/source/quickstart.rst): a first federated training run (FedAvg on FedSynthetic). Every shown code block is embedded via Sphinx literalinclude from the runnable script test-files/quickstart.py, so the docs and the executable source cannot drift apart. Fragment boundaries in the script are delimited by marker comments (# --- begin/end: core ---).
  • Add a Core concepts page (docs/source/concepts.rst): the four building blocks (FedDataset / model / Server / Client), the algorithm-hook model (20 registered algorithms customize hooks, not the loop), and the fixed per-round execution order.
  • Rework the Getting started toctree: install, quickstart, concepts. The empty examples.rst placeholder becomes an :orphan: redirect stub pointing to the new pages, preserving old URLs; its zh_CN catalog is updated instead of deleted.
  • Fix docs/source/cli.rst: the hand-copied YAML block had drifted from example-configs/all-alg-fedprox-femnist.yml (indentation, algorithm list, interpolated values) and was not parseable as-is; it is now a literalinclude of the source file.
  • Add test/test_tutorial_scripts.py: behavioral smoke tests that execute the tutorial scripts in-process (runpy with run_name="__main__", isolated temporary log directory, sys.path restored afterwards), assert the tutorial runtime budget from each run's config.json (num_iters <= 5, num_clients <= 30, one local epoch), and verify that every literalinclude target in the docs exists.
  • zh_CN translations for the new and updated pages via the existing gettext pipeline.

Validation

  • pytest test/test_tutorial_scripts.py test/test_executors.py test/test_hook_contract.py test/test_nodes.py test/test_messages.py test/test_custom.py: 44 passed.
  • English docs build: zero warnings. zh_CN docs build: no new warnings vs master.
  • Tutorial script runs end to end in ~11 s on a laptop (5 rounds, 10 clients, synthetic data).

- quickstart.rst: a first federated training run; the shown code is
  embedded via literalinclude from the runnable script
  test-files/quickstart.py, so documentation blocks cannot drift from
  the executable source
- concepts.rst: the four building blocks (dataset, model, server,
  client), algorithm hooks, and the fixed per-round order
- index.rst: Getting started now lists install, quickstart, concepts
- examples.rst: the empty placeholder page becomes an orphan redirect
  stub pointing to quickstart
- cli.rst: replace the hand-copied YAML block, which had drifted from
  example-configs/all-alg-fedprox-femnist.yml and was not parseable,
  with a literalinclude of the source file
- test/test_tutorial_scripts.py: behavioral smoke tests for the tutorial
  scripts, executed under runpy with an isolated log directory; asserts
  the tutorial runtime budget from each run's config.json and that every
  literalinclude target in the docs exists
- zh_CN translations for the new and updated pages
@codecov

codecov Bot commented Oct 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.39%. Comparing base (a21cbb4) to head (466cb69).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #56      +/-   ##
==========================================
+ Coverage   82.32%   82.39%   +0.07%     
==========================================
  Files          55       55              
  Lines        5640     5640              
==========================================
+ Hits         4643     4647       +4     
+ Misses        997      993       -4     

see 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@wenh06
wenh06 merged commit 11c19de into master Oct 26, 2026
28 checks passed
@wenh06
wenh06 deleted the docs-tutorials-a branch October 26, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant