Skip to content

feat: Add docstrings to generated Python APIs - #593

Closed
razor-x wants to merge 3 commits into
mainfrom
codex/add-docstring-support-to-codegen
Closed

feat: Add docstrings to generated Python APIs#593
razor-x wants to merge 3 commits into
mainfrom
codex/add-docstring-support-to-codegen

Conversation

@razor-x

@razor-x razor-x commented Jul 28, 2026

Copy link
Copy Markdown
Member

Motivation

  • Propagate Blueprint descriptions and deprecation metadata into the Python code generator so generated SDK surfaces carry documentation and deprecation signals.
  • Produce Sphinx-friendly docstrings for generated route methods, abstract route classes, and resource dataclasses to improve developer ergonomics and enable native Python deprecation notices.
  • Ensure deprecated endpoints/params/resources are clearly marked using Python-native mechanisms in generated code.

Description

  • Extend the codegen model and plugins to carry description and deprecation fields (codegen/lib/class-model.ts, codegen/lib/routes.ts) and build method/resource docstrings (codegen/lib/layouts/route.ts, codegen/lib/layouts/resources.ts).
  • Add docstring templating to the Handlebars layouts so generated abstract classes, concrete routes, method implementations, and dataclass resources include Sphinx-style docs with :param/:type/:returns/:vartype/:ivar and .. deprecated:: directives (changes to codegen/layouts/partials/*.hbs and codegen/layouts/route.hbs).
  • Escape and indent doc content safely and include parameter-level deprecation messages and response documentation in method docstrings; resource dataclasses now expose typed :ivar docs for all properties.
  • Regenerated Python output under seam/routes and seam/resources to include the new docstrings and deprecation annotations across the SDK surface.

Testing

  • Ran TypeScript checks with npm run typecheck (passed).
  • Ran linters and formatting with npm run lint and npm run format (passed); code style fixes applied where necessary.
  • Ran the generator with npm run generate (generation completed; the run emitted a small set of blueprint warnings about undocumented types but successfully produced regenerated modules).
  • Formatted Python and compiled generated modules with PYENV_VERSION=3.12.13 make format and PYENV_VERSION=3.12.13 python -m compileall -q seam (format/compile run in the environment with 3.12.13 succeeded); git diff --check returned clean.
  • Attempted PYENV_VERSION=3.12.13 poetry run pytest -q but tests could not run because the environment could not download urllib3 from PyPI (network / package fetch blocked); thus test suite is blocked on dependency fetch and not fully exercised here.

Codex Task

@razor-x
razor-x requested a review from a team as a code owner July 28, 2026 15:39
@razor-x razor-x changed the title Add docstrings to generated Python APIs feat: Add docstrings to generated Python APIs Jul 28, 2026
@razor-x razor-x closed this Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant