Skip to content

docs: annotate generic Context examples - #428

Open
codeforester wants to merge 6 commits into
mainfrom
documentation/427-20261005-docs-annotate-generic-context-examples
Open

codeforester wants to merge 6 commits into
mainfrom
documentation/427-20261005-docs-annotate-generic-context-examples

Conversation

@codeforester

Copy link
Copy Markdown
Contributor

Summary

Update public README and integration examples to use the three-parameter base_cli.Context[object, object, object] form required by strict typing. This is the documentation follow-up to merged PR #414.

Issue

Fixes #427

Validation

  • tests/full_validate.sh --gate contracts
  • tests/full_validate.sh --gate typing
  • No unparameterized base_cli.Context remains in the affected docs.

@codeforester codeforester left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head e36e460 against #427 (follow-up to #414). Every bare base_cli.Context in the README and docs/integrations.md is now parameterized. One substantive issue: object makes some of the examples fail strict mypy, which is the thing this PR is meant to fix.

#414 standardized on base_cli.Context[Any, Any, Any] (docs/testing.md, examples/minimal_cli), but this PR uses Context[object, object, object]. That's fine wherever the example only touches ctx.log/ctx.environment/ctx.dry_run. It breaks wherever the example uses the typed config. I ran mypy --strict against this branch on the README factory snippet (make_services → Services(ctx.config), with Services.__init__(self, config: Config)):

Context[object, object, object]: error: Argument 1 to "Services" has incompatible type "object"; expected "Config"  [arg-type]
Context[Any, Any, Any]:          Success: no issues found

Suggestion: use Context[Any, Any, Any] (with from typing import Any) for consistency with docs/testing.md and the shipped example. For the factory section, use the concrete Context[Config, ApplicationContext, Services] that the README already introduces near line 181.

Nits: the prose change "receive the active base_cli.Context" → "the active Context" loses the namespace for no apparent reason. The cancelled Publish issue branch policy run is a superseded duplicate; the required base/issue-branch-policy status is green.

Comment thread README.md Outdated


def make_services(ctx: base_cli.Context) -> Services:
def make_services(ctx: base_cli.Context[object, object, object]) -> Services:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With Context[object, object, object], ctx.config is object, so Services(ctx.config) fails mypy --strict when Services takes a Config (verified). Context[Config, ApplicationContext, Services] (or Any) type-checks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in commit 96ca879d. The generic examples now use Context[Any, Any, Any] with explicit from typing import Any; the factory example uses the concrete Context[Config, ApplicationContext, Services]; and the prose keeps the public base_cli.Context namespace. Documentation validation, the full test suite, Ruff, and strict mypy (with the declared Typer extra) all pass.

@codeforester

Copy link
Copy Markdown
Contributor Author

Review follow-up complete in 96ca879d: generic context examples now type-check with Context[Any, Any, Any], the factory example uses the concrete consumer context type, and the base_cli.Context namespace is retained in prose. The full test suite and documentation validation pass; Ruff and strict mypy pass with the Typer extra.

…61005-docs-annotate-generic-context-examples
@codeforester

Copy link
Copy Markdown
Contributor Author

Also synced the branch with current main in merge commit 9033e78b after #416 landed; no conflicts. Post-sync documentation validation, full tests, Ruff, and strict mypy all pass. Hosted checks are queued; no failures reported.

…61005-docs-annotate-generic-context-examples
@codeforester

Copy link
Copy Markdown
Contributor Author

Final branch sync: merged current main (including #417) into this PR as b7b97ecf. No conflicts. Post-sync docs validation, full tests, Ruff, and strict mypy pass locally. The fresh hosted checks are queued with no failures.

…61005-docs-annotate-generic-context-examples
@codeforester

Copy link
Copy Markdown
Contributor Author

Re-verified at 81f9d9f: addressed ✅. Generic examples use base_cli.Context[Any, Any, Any] with explicit from typing import Any, matching docs/testing.md and examples/minimal_cli. The factory section uses the concrete Context[Config, ApplicationContext, Services], which I confirmed passes mypy --strict on the Services(ctx.config) pattern. Prose keeps the base_cli.Context namespace. CI is green. Ready to merge.

…61005-docs-annotate-generic-context-examples
@codeforester

Copy link
Copy Markdown
Contributor Author

Resolved the #428 branch divergence by merging current origin/main (including #423) into the existing documentation branch. The merge completed without textual conflicts; the branch now points to cd04c79 and retains only the intended generic-context documentation changes in README.md and docs/integrations.md.

Validation passed:

  • full pytest suite: 661 passed, 2 skipped;
  • focused contract/config/documentation tests: passed;
  • Ruff check and format: passed;
  • strict mypy: passed;
  • Markdown and changelog validators: passed.

PR #428 remains open and unmerged while hosted checks complete.

This branch has not been deployed

No deployments
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.

docs: annotate generic Context examples

1 participant