Skip to content

GraphQL Codegen for Python clients#89

Merged
ejfine merged 6 commits intomainfrom
codegen
Sep 10, 2025
Merged

GraphQL Codegen for Python clients#89
ejfine merged 6 commits intomainfrom
codegen

Conversation

@ejfine
Copy link
Contributor

@ejfine ejfine commented Sep 10, 2025

Why is this change necessary?

Allow easier generation of code for writing E2E tests

How does this change address the issue?

Adds some excludes to pre-commit hooks to not touch the autogenerated code
Adds some versions to context.py

What side effects does this change have?

None

How is this change tested?

Downstream repos

Summary by CodeRabbit

  • Chores
    • Updated pre-commit configuration formatting; enabled typo checks for UMD bundles; excluded generated and template code from linters/type checkers to streamline development and CI.
    • Bumped versions of build/codegen tools and added missing entries to shared context for improved compatibility.
    • Adjusted type checker settings to skip generated sources.
    • Updated development container metadata.
    • No user-facing behavior changes.

@ejfine ejfine requested a review from Copilot September 10, 2025 16:32
@ejfine ejfine self-assigned this Sep 10, 2025
@coderabbitai
Copy link

coderabbitai bot commented Sep 10, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Configuration updates across devcontainer, pre-commit, and Pyright to adjust exclusions; dependency/version constants updated in context files, including new keys for code generators. No functional runtime or control-flow changes; primarily tooling and metadata updates.

Changes

Cohort / File(s) Summary of changes
Devcontainer metadata
.devcontainer/devcontainer.json
Updated context hash comment (b8c69216 → b9c719df).
Pre-commit config
.pre-commit-config.yaml
Reformatted exclude blocks; added excludes for graphql_codegen/openapi_codegen across ruff/pyright/pylint; added template/ exclude to pylint; removed .umd.js from typos excludes (now included).
Pyright excludes
pyrightconfig.json
Added **/graphql_codegen and **/openapi_codegen to exclude list.
Context versions
extensions/context.py
Bumped versions: pyinstaller 6.13.0→6.15.0, eslint ^9.34.0→^9.35.0, nuxt-ui ^3.3.2→^3.3.3, graphql-codegen CLI ^5→^6, TS plugin ^4→^5; added ariadne_codegen_version 0.15.2 and graphql_codegen_typescript_operations_version ^5.0.0.
Template context additions
template/extensions/context.py.jinja-base
Added context keys: ariadne_codegen_version, graphql_codegen_typescript_operations_version.

Sequence Diagram(s)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Pre-merge checks (1 passed, 2 warnings)

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The current description follows the template for “Why,” “How,” “Side effects,” and “Testing,” but it omits the required “Link to Issue or Message thread” section and the “Other” section defined in the repository’s PR template, leaving essential context and any miscellaneous notes unaddressed. Please add a “Link to Issue or Message thread” at the top with any relevant ticket or discussion URL, and include an “Other” section for any additional remarks or future considerations to fully comply with the repository’s PR description template.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title “GraphQL Codegen for Python clients” accurately highlights the main intent of the changeset, which is to enable and streamline GraphQL code generation support (including pre-commit exclusions and context version updates) for Python client use cases. Although it does not enumerate every update, it clearly reflects the primary enhancement being introduced.

Poem

I nudge my nose at YAML lines,
Excludes hop left, new keys align.
Codegen burrows skip the check,
Versions sprout—peep!—deck by deck.
No runtime chase, just tidy trails;
A rabbit’s lint, with whiskered details. 🐇✨

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codegen

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for GraphQL code generation for Python clients by introducing new package versions and excluding autogenerated code from linting and type checking. This enables easier generation of code for writing E2E tests.

  • Adds ariadne_codegen and graphql_codegen package versions to context configuration
  • Updates various package versions (pyinstaller, nuxt_ui, eslint, graphql_codegen packages)
  • Excludes graphql_codegen and openapi_codegen directories from pre-commit hooks and type checking

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
template/extensions/context.py.jinja-base Adds template variables for ariadne_codegen and graphql_codegen_typescript_operations versions
extensions/context.py Updates package versions and adds new GraphQL codegen dependencies
.pre-commit-config.yaml Excludes autogenerated code directories from linting and formatting hooks
pyrightconfig.json Excludes autogenerated code directories from type checking
.devcontainer/devcontainer.json Updates devcontainer context hash

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

context["nuxt_apollo_version"] = "{{ nuxt_apollo_version }}"
context["graphql_codegen_cli_version"] = "{{ graphql_codegen_cli_version }}"
context["graphql_codegen_typescript_version"] = "{{ graphql_codegen_typescript_version }}"
context["graphql_codegen_typescript_operations_version"] = "{{ graphql_codegen_typescript_version }}"
Copy link

Copilot AI Sep 10, 2025

Choose a reason for hiding this comment

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

The variable name suggests this should use graphql_codegen_typescript_operations_version template variable, but it's using graphql_codegen_typescript_version. This will cause the typescript operations version to use the wrong template value.

Suggested change
context["graphql_codegen_typescript_operations_version"] = "{{ graphql_codegen_typescript_version }}"
context["graphql_codegen_typescript_operations_version"] = "{{ graphql_codegen_typescript_operations_version }}"

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
.pre-commit-config.yaml (1)

232-236: Consistent exclusion of generated code across ruff/pylint/pyright — LGTM

Good alignment across hooks. Optional: consider YAML anchors to DRY the repeated codegen patterns.

Example anchor usage:

 minimum_pre_commit_version: 4.2.0
+# anchors to reuse common excludes
+_codegen_exclude: &codegen_exclude |
+  (?x)^(
+      .*/graphql_codegen/.*|
+      .*/openapi_codegen/.*
+  )$
 ...
       - id: ruff
         name: ruff-src
         args: [--fix, --config=./ruff.toml]
         files: src/.+\.py$
-        exclude: |
-          (?x)^(
-              .*/graphql_codegen/.*|
-              .*/openapi_codegen/.*
-          )$
+        exclude: *codegen_exclude

Also applies to: 241-245, 247-251, 258-264, 275-279

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3e7e3e5 and 004d972.

📒 Files selected for processing (5)
  • .devcontainer/devcontainer.json (1 hunks)
  • .pre-commit-config.yaml (3 hunks)
  • extensions/context.py (2 hunks)
  • pyrightconfig.json (1 hunks)
  • template/extensions/context.py.jinja-base (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: lint-matrix (ubuntu-24.04, 3.12.7, --data-file tests/copier_data/data2.yaml)
🔇 Additional comments (9)
pyrightconfig.json (1)

13-14: Add codegen excludes for Pyright — LGTM

Excluding generated GraphQL/OpenAPI code from type checking is appropriate here.

.devcontainer/devcontainer.json (1)

62-62: Auto-managed devcontainer context hash — LGTM

No action required.

template/extensions/context.py.jinja-base (1)

39-39: New template variables wired correctly

Both ariadne_codegen_version and graphql_codegen_typescript_operations_version are correctly added and named.

Also applies to: 63-63

extensions/context.py (3)

44-44: Add ariadne codegen version — LGTM

Value looks reasonable and matches the template variable.


37-37: Version bumps — LGTM

pyinstaller_version, nuxt_ui_version, and eslint_version updates look fine.

Also applies to: 47-47, 60-60


66-68: Peer dependencies align; no compatibility issues
CLI v6.0.0 and both plugins at v5.0.0 support overlapping graphql ranges (CLI: ^0.8.0–^16.0.0; plugins: ^0.12.0–^16.0.0) and have no conflicting peer requirements.

.pre-commit-config.yaml (3)

48-53: Typos exclude block — LGTM

Patterns are scoped to minified/UMD assets; reasonable to skip for spelling checks.


58-62: Trailing-whitespace exclude — LGTM

Snapshot and vendor paths excluded appropriately.


65-78: End-of-file-fixer excludes — LGTM

Exclusions align with generators and known edge cases.

@ejfine ejfine merged commit 4003c22 into main Sep 10, 2025
7 checks passed
@ejfine ejfine deleted the codegen branch September 10, 2025 17:21
@coderabbitai coderabbitai bot mentioned this pull request Oct 16, 2025
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.

2 participants