feat: Replace Example[T] generation with markdown-based example docs#19
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #19 +/- ##
==========================================
+ Coverage 77.77% 79.84% +2.07%
==========================================
Files 76 80 +4
Lines 4818 4982 +164
==========================================
+ Hits 3747 3978 +231
+ Misses 1071 1004 -67 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
EspenAlbert
added a commit
that referenced
this pull request
Feb 24, 2026
…19) * refactor(pkg-ext): remove Example[T] generation machinery * refactor(pkg-ext): remove test generation from pre_change workflow * feat(pkg-ext): add gen-example-prompt and check-examples commands * chore: gen docs * refactor(examples): reuse format_signature and extract shared filter function * feat(docs): link example files in generated group documentation * refactor(examples): rename ExampleMetadata, add missing tests, tighten PR description * chore: regen * refactor(pkg-ext): remove gen_tests command and test_gen module * feat(changelog): add change-base command and pre-commit base-branch validation * chore: regen docs * feat(changelog): auto-remap stale SHAs after rebase * feat(docs): add examples to mkdocs nav and replace table with per-symbol inline links * fix(docs): update example link paths in generated documentation * chore: updates changelog files * chore: self review * chore: regen
This was referenced Feb 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: Replace Example[T] generation with markdown-based example docs
What
Overhaul pkg-ext's example documentation system: remove the
Example[T]Pydantic subclass generation machinery and replace it with markdown-based example docs validated by pytest-examples. Also clean up dead code left behind and add changelog tooling for rebasing and PR stacking.Changes
t07-40: Remove Example[T] generation
example_gen.pymodule and its testsgen-examplesCLI commandexamples_enabled,examples_excludeconfig fields and all associated filtering/rendering methodsexamples_file_pathfromPkgSettingsandgenerate_examples_for_groupsfrompre_changeworkflowexamples_includeonGroupConfigas the source of truth for which symbols need example docst07-41: Add gen-example-prompt and check-examples commands
gen-example-prompt: builds an AI prompt from API dump data (signatures, docstrings, related types, test code) for symbols missing example docs. Copies to clipboard viapbcopy. Supports--groupfilter.check-examples: verifies every symbol inexamples_includehas a corresponding.mdfile underdocs/examples/{group}/. Exits non-zero on missing files. Skippable viaSKIP_EXAMPLES_CHECK=1.examples.py, CLI wiring incli/example_cmds.pyt07-42: Link example files from generated docs
parse_description_comment; threaded example context throughrender_group_indexandgenerate_docst07-43: Remove gen_tests command and test_gen module
test_gen.py,test_gen_test.pyfromgeneration/gen_testsCLI command, its registration inbase_commands.py, and its re-export ingenerate.pygenerate_tests_for_groups()fromworkflow_cmds.pyandfilter_group_by_examples_include()fromexamples.pytest_file_path()fromPkgSettings.groups.yamlowned_refsand unused importst07-44: Auto-remap changelog SHAs after rebase
add_git_changesbefore the commit loopFixActionentries to new commits by exact commit message, using timestamp proximity as a tiebreakerraise_on_questionbehavior -- auto-matched SHAs are applied silently, unmatched entries triggerNoHumanRequiredErrort07-45: Add change-base command and pre-commit base-branch validation
change-baseCLI command -- diffs.changelog/between the new base and HEAD, finds changelog files belonging to other PRs, consolidates their actions into the current PR's file, and deletes the originalschange-baset07-46: Add examples to mkdocs nav and inline per-symbol links
- [Example: {description}]({link})lines rendered directly after the source link_render_nav_yamlsupports 3-level nesting for the Examples sub-navWhy
The
Example[T]Pydantic subclass approach coupled code examples tightly to the generation pipeline. Replacing it with standalone markdown files validated by pytest-examples gives better authoring ergonomics, simpler tooling, and docs that link directly to example files. The changelog improvements (SHA remapping, change-base) fix real pain points when rebasing and stacking PRs.Reviewer notes
gen-examplesandgen_testsCLI commands are removed. No known callers outside manual use.examples_enabledandexamples_excludeconfig fields inpyproject.tomlare no longer recognized. Migrate toexamples_includeonly.SymbolContext.has_examplesis removed -- symbols that previously got their own page solely because they had examples will now be inlined on the group index page (unless they have env vars or meaningful changelog changes).render_examples_section) is removed. Example links now appear inline next to each symbol's source link, with the description from the example file's YAML comment header.NavItemchildren can now contain nested lists (for the Examples sub-nav)._render_nav_yamlhandles 3-level YAML indentation.NavChildItemtype alias added.CommentConfig.md), not snake_case.clipboard.pyduplicates thepbcopypattern from adoc to avoid a cross-package dependency.find_changelog_files_in_diffshells out togit diff --name-only {base}...HEAD-- requires the base ref to be locally available. In CI this is always true; locally it may need agit fetchfirst.gh pr viewreturns PR info (CI context). Local dev without an active PR skips the check.