Skip to content

Conversation

damusss
Copy link
Member

@damusss damusss commented May 13, 2025

Ported the docs from sdl2_video to pygame._render, using the autoapi docs system (I added one line to make it work). The constructor of Renderer and the blit methods are the only one currently referencing things that have not been ported. Tho it won't be like this anymore since the PRs to port them are already up. I can change if needed, but I don't think so as this is an experimental, privated module with a big warning.

EDIT (also explaining things better after discussing with @Starbuck5): I removed _render from index.rst. I also removed render.rst. This means tat the only thing happening with this PR is that the stubs of _render start getting the docs of sdl2_video. When pygame.window was first born, it was still experimental, but it got the documentation, and eventually started getting features while sdl2_video.Window was left behind. _render, written properly in C, is the future replacement of some of the features of sdl2_video.video, which will be "left behind" as well (otherwise, what's even the point), meaning _render, which will become render when it is complete, require docs (and should use the new system). Sooner or later it must have docs. Now, since I'm using the new system, I can add docs without them existing in pyga.me/docs because as long as no render.rst exists, autoapi will not in fact make them exist. The module will stay private. This PR allows for _render to get docs gradually. Otherwise, some time in the future, Renderer, Texture, Image and whatever would have to get their docs all at once. If you are still confused I'm here to explain, or if you have concerns, I'm here for feedback!

@damusss damusss requested a review from a team as a code owner May 13, 2025 14:55
@damusss damusss added docs _sdl2 pygame._sdl2 labels May 13, 2025
@damusss damusss requested a review from zoldalma999 May 13, 2025 17:26
@ankith26
Copy link
Member

ankith26 commented Jul 3, 2025

#3519 and #3520 may have implications on this PR

Copy link
Contributor

coderabbitai bot commented Aug 26, 2025

📝 Walkthrough

Walkthrough

Renderer stub API expanded: new configurable Renderer.__init__, Renderer.to_surface, and Renderer.target property added; extensive docstrings for module, classes, and methods. Docs build behavior changed to keep PythonModule from being skipped. Minor punctuation fix in index.rst.

Changes

Cohort / File(s) Summary
Render stub API updates
buildconfig/stubs/pygame/_render.pyi
Replaced Renderer.__init__ signature with (window, index: int = -1, accelerated: int = -1, vsync: bool = False, target_texture: bool = False) -> None; added Renderer.to_surface(surface: Optional[Surface]=None, area: Optional[RectLike]=None) -> Surface; added Renderer.target property (getter/setter); expanded module, class, and method docstrings and public type hints (Surface, RectLike, Point, Color, Window).
Docs build extension behavior
docs/reST/ext/documenters.py
Imported PythonModule and set PythonModule._should_skip = lambda *args, **kwargs: False inside setup() to prevent skipping module documentation during generation.
Docs text tweak
docs/reST/index.rst
Fixed punctuation in a bold heading (typographical change only).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant App
  participant Renderer
  participant Window
  participant Texture
  participant Surface

  App->>Renderer: __init__(window, index, accelerated, vsync, target_texture)
  note right of Renderer: Configure backend & features

  App->>Renderer: target = Texture
  note right of Renderer: Swap render target

  App->>Renderer: blit(Image/Texture, ...)
  Renderer->>Renderer: Queue draw commands

  App->>Renderer: present()
  Renderer->>Window: Swap buffers / present

  App->>Renderer: to_surface(surface=None, area=None)
  note right of Renderer: Read pixels from current target (slow)
  Renderer->>Surface: Return populated Surface
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

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

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Member

@MyreMylar MyreMylar left a comment

Choose a reason for hiding this comment

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

OK, LGTM. Keeping these up to date is a moving target as render adds more features, but this is a good start!

Copy link
Contributor

@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: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/reST/ext/documenters.py (1)

96-101: Guard against empty module docstrings to avoid IndexError in :synopsis:.

If a module has no docstring, self.get_doc()[0][0] raises an IndexError. The new behavior (un-skipping PythonModule) increases the chance of this occurring.

Apply this diff to safely handle empty docs:

     def add_directive_header(self, sig: str) -> None:
         super().add_directive_header(sig)
         if "module" in self.objtype:
             sourcename = self.get_sourcename()
-            self.add_line(f"   :synopsis: {self.get_doc()[0][0]}", sourcename)
+            doc_lines = self.get_doc()[0]
+            if doc_lines:
+                synopsis = doc_lines[0]
+                self.add_line(f"   :synopsis: {synopsis}", sourcename)
🧹 Nitpick comments (7)
docs/reST/ext/documenters.py (2)

158-160: Scope and defend the PythonModule._should_skip monkey patch.

Overriding _should_skip globally is brittle and may surface unintended modules. Scope it to our targets and keep the original for everything else. Also, guard for environments where _PythonModule is None or lacks _should_skip.

Apply this diff:

-    PythonModule._should_skip = lambda *args, **kwargs: False
+    # Only patch when available; keep original behavior elsewhere.
+    if _PythonModule is not None and hasattr(_PythonModule, "_should_skip"):
+        _orig_should_skip = _PythonModule._should_skip
+
+        def _pg_should_skip(self, *args, **kwargs):
+            # Always include pygame._render and its submodules
+            try:
+                obj_id = getattr(self, "obj", None).id  # autoapi object id (e.g., "pygame._render")
+            except Exception:
+                obj_id = None
+            if isinstance(obj_id, str) and obj_id.startswith("pygame._render"):
+                return False
+            # Defer to original behavior for everything else
+            return _orig_should_skip(self, *args, **kwargs)
+
+        _PythonModule._should_skip = _pg_should_skip

103-110: Prefer list over generator for members to avoid one-shot consumption.

AutoAPI can iterate members multiple times; returning a generator risks exhausted iterators and subtle omissions.

Apply this diff:

-        members = (
-            member
-            for member in members
-            if not member.object.imported and get_doc(self.env, member.object) != ""
-        )
+        members = [
+            member
+            for member in members
+            if not member.object.imported and get_doc(self.env, member.object) != ""
+        ]
buildconfig/stubs/pygame/_render.pyi (5)

9-28: Avoid second top-level triple-quoted string; move future docs out of runtime.

The “render.rst contents for the future” block is a standalone string literal at module scope. It isn’t used as the module docstring (only the first string is), but it is still allocated at import-time and may confuse tooling.

Apply this diff to turn it into comments (or move to a .rst file):

-# render.rst contents for the future
-"""
-.. include:: common.txt
-
-:mod:`pygame._render`
-=====================
-
-.. warning::
-   This module isn't ready for prime time yet, it's still in development.
-   These docs are primarily meant to help the pygame developers and
-   super-early adopters who are in communication with the developers.
-   This API will change.
-
-   Also, this module is a C implementation of most of the features of the
-   sdl2_video module. It is currently incomplete.
-
-.. autopgmodule:: pygame._render
-   :members:
-
-"""
+# render.rst contents for the future (kept here for reference)
+# .. include:: common.txt
+# :mod:`pygame._render`
+# =====================
+# .. warning::
+#   This module isn't ready for prime time yet, it's still in development.
+#   These docs are primarily meant to help the pygame developers and
+#   super-early adopters who are in communication with the developers.
+#   This API will change.
+#   Also, this module is a C implementation of most of the features of the
+#   sdl2_video module. It is currently incomplete.
+# .. autopgmodule:: pygame._render
+#    :members:

77-85: Add a short init docstring to explain the renderer selection flags.

Constructor parameters (index, accelerated, vsync, target_texture) need brief semantics for users.

Apply this diff:

-    ) -> None: ...
+    ) -> None:
+        """Create a Renderer for a Window.
+
+        :param window: Target window to render into.
+        :param index: Renderer driver index to use, or -1 for the default driver.
+        :param accelerated: Prefer acceleration (1), no acceleration (0), or -1 to let SDL decide.
+        :param vsync: Enable presentation synchronized to the display's refresh.
+        :param target_texture: Allow rendering to textures (enables :pyattr:`Renderer.target`).
+
+        .. versionadded:: 2.5.4
+        """

192-196: Remove repeated sentence in present() docs.

“Updates the screen with any rendering performed since the previous call.” appears twice.

Apply this diff:

-        Presents the composed backbuffer to the screen.
-        Updates the screen with any rendering performed since the previous call.
+        Presents the composed backbuffer to the screen.

213-235: Use consistent Sphinx param/type style in to_surface().

Prefer :param name: plus :type name: to avoid embedding the type in the parameter field. It also matches the rest of this file’s style.

Apply this diff:

-        :param Surface surface: A :class:`pygame.Surface` object to read the pixel
+        :param surface: A :class:`pygame.Surface` object to read the pixel
                                 data into. It must be large enough to fit the area, otherwise
                                 ``ValueError`` is raised.
                                 If set to ``None``, a new surface will be created.
-        :param area: The area of the screen to read pixels from. The area is
+        :param area: The area of the screen to read pixels from. The area is
                     clipped to fit inside the viewport.
                     If ``None``, the entire viewport is used.
+        :type surface: Optional[Surface]
+        :type area: Optional[RectLike]

290-291: Align return-usage docs with current API (properties, not setters).

There is no Renderer.set_draw_blend_mode or Texture.set_blend_mode method in this stub; users should set the properties.

Apply this diff:

-        :return: A blend mode to be used with :meth:`Renderer.set_draw_blend_mode` and :meth:`Texture.set_blend_mode`.
+        :return: A blend mode to be used with :attr:`Renderer.draw_blend_mode` and :attr:`Texture.blend_mode`.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f46a4b6 and fb62f5b.

📒 Files selected for processing (3)
  • buildconfig/stubs/pygame/_render.pyi (4 hunks)
  • docs/reST/ext/documenters.py (2 hunks)
  • docs/reST/index.rst (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
buildconfig/stubs/pygame/_render.pyi (2)
buildconfig/stubs/pygame/rect.pyi (1)
  • Rect (303-303)
buildconfig/stubs/pygame/_sdl2/video.pyi (23)
  • clear (144-144)
  • draw_line (160-160)
  • draw_point (161-161)
  • draw_quad (87-101)
  • draw_quad (166-166)
  • draw_rect (162-162)
  • draw_triangle (75-86)
  • draw_triangle (164-164)
  • fill_quad (167-167)
  • fill_rect (163-163)
  • fill_triangle (165-165)
  • get_viewport (146-146)
  • present (145-145)
  • set_viewport (147-147)
  • coordinates_to_window (149-149)
  • coordinates_from_window (150-150)
  • to_surface (168-170)
  • draw_color (141-141)
  • draw_color (143-143)
  • compose_custom_blend_mode (172-174)
  • from_window (138-138)
  • Renderer (128-174)
  • Texture (42-102)
⏰ 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). (10)
  • GitHub Check: build (macos-14)
  • GitHub Check: msys2 (ucrt64, ucrt-x86_64)
  • GitHub Check: msys2 (clang64, clang-x86_64)
  • GitHub Check: msys2 (mingw64, x86_64)
  • GitHub Check: i686
  • GitHub Check: aarch64
  • GitHub Check: x86_64
  • GitHub Check: AMD64
  • GitHub Check: x86
  • GitHub Check: dev-check
🔇 Additional comments (2)
docs/reST/index.rst (1)

60-60: Typo/punctuation fix looks good.

Removing the extra space before the colon reads cleaner and aligns with house style.

buildconfig/stubs/pygame/_render.pyi (1)

6-7: Please verify version markers before merging
It looks like every entry in buildconfig/stubs/pygame/_render.pyi is marked with

.. versionadded:: 2.5.4

but I wasn’t able to confirm from the codebase whether the experimental pygame._render module (including Renderer.to_surface and Renderer.target) actually landed in version 2.5.4 or in a later pygame-ce release. Please double-check the official changelog or release notes and update the .. versionadded:: directives to the correct version to avoid misleading documentation.

Comment on lines +102 to +103
.. note:: Textures created by different Renderers cannot shared with each other!

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Grammar: “cannot shared” → “cannot be shared”.

Minor but visible in the public docs.

Apply this diff:

-        .. note:: Textures created by different Renderers cannot shared with each other!
+        .. note:: Textures created by different Renderers cannot be shared with each other!
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
.. note:: Textures created by different Renderers cannot shared with each other!
.. note:: Textures created by different Renderers cannot be shared with each other!
🤖 Prompt for AI Agents
In buildconfig/stubs/pygame/_render.pyi around lines 102 to 103, fix the grammar
in the docstring by changing "cannot shared" to "cannot be shared"; update the
note line to read: "Textures created by different Renderers cannot be shared
with each other!" and save the file.

Comment on lines +130 to +134
:param p1: The first quad point.
:param p2: The second quad point.
:param p2: The third quad point.
:param p2: The fourth quad point.

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix parameter names in draw_quad docs (p3/p4 mislabelled).

Parameters are repeated as p2 for p3 and p4.

Apply this diff:

-        :param p2: The third quad point.
-        :param p2: The fourth quad point.
+        :param p3: The third quad point.
+        :param p4: The fourth quad point.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
:param p1: The first quad point.
:param p2: The second quad point.
:param p2: The third quad point.
:param p2: The fourth quad point.
:param p1: The first quad point.
:param p2: The second quad point.
:param p3: The third quad point.
:param p4: The fourth quad point.
🤖 Prompt for AI Agents
In buildconfig/stubs/pygame/_render.pyi around lines 130 to 134, the docstring
parameter labels for the third and fourth quad points are incorrectly repeated
as `p2`; update the parameter names so they read `:param p3: The third quad
point.` and `:param p4: The fourth quad point.` to match the actual parameters
and fix the documentation.

Comment on lines +149 to +152
:param p1: The first triangle point.
:param p2: The second triangle point.
:param p2: The third triangle point.

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix parameter name in draw_triangle docs (p3 mislabelled).

Third point is documented as p2.

Apply this diff:

-        :param p2: The third triangle point.
+        :param p3: The third triangle point.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
:param p1: The first triangle point.
:param p2: The second triangle point.
:param p2: The third triangle point.
:param p1: The first triangle point.
:param p2: The second triangle point.
:param p3: The third triangle point.
🤖 Prompt for AI Agents
In buildconfig/stubs/pygame/_render.pyi around lines 149 to 152, the docstring
for draw_triangle incorrectly documents the third triangle point as ":param p2:"
instead of ":param p3:". Update the third parameter documentation line to read
":param p3: The third triangle point." (ensure only the parameter name is
corrected and formatting preserved).

Comment on lines +159 to +163
:param p1: The first quad point.
:param p2: The second quad point.
:param p2: The third quad point.
:param p2: The fourth quad point.

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix parameter names in fill_quad docs (p3/p4 mislabelled).

Same issue as draw_quad.

Apply this diff:

-        :param p2: The third quad point.
-        :param p2: The fourth quad point.
+        :param p3: The third quad point.
+        :param p4: The fourth quad point.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
:param p1: The first quad point.
:param p2: The second quad point.
:param p2: The third quad point.
:param p2: The fourth quad point.
:param p1: The first quad point.
:param p2: The second quad point.
:param p3: The third quad point.
:param p4: The fourth quad point.
🤖 Prompt for AI Agents
In buildconfig/stubs/pygame/_render.pyi around lines 159 to 163, the docstring
for fill_quad mislabels the third and fourth quad point parameters as p2; update
the parameter names so they read ":param p1: The first quad point.", ":param p2:
The second quad point.", ":param p3: The third quad point.", and ":param p4: The
fourth quad point." to match draw_quad and accurately document p3 and p4.

Comment on lines +178 to +181
:param p1: The first triangle point.
:param p2: The second triangle point.
:param p2: The third triangle point.

Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix parameter name in fill_triangle docs (p3 mislabelled).

Third point is documented as p2.

Apply this diff:

-        :param p2: The third triangle point.
+        :param p3: The third triangle point.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
:param p1: The first triangle point.
:param p2: The second triangle point.
:param p2: The third triangle point.
:param p1: The first triangle point.
:param p2: The second triangle point.
:param p3: The third triangle point.
🤖 Prompt for AI Agents
In buildconfig/stubs/pygame/_render.pyi around lines 178 to 181, the docstring
for fill_triangle incorrectly repeats p2 for the third parameter; update the
third param line to ":param p3: The third triangle point." so the parameter name
matches the function signature and documentation.

Comment on lines +267 to 277
def target(self) -> "Texture":
"""Get or set the current rendering target

Gets or sets the current rendering target.
A value of ``None`` means that no custom rendering target was set and the
Renderer's window will be used as the target.

.. versionadded:: 2.5.4
"""
@target.setter
def target(self, value: "Texture") -> None: ...
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Type mismatch vs. docs: Renderer.target should be Optional[Texture].

Docs say “A value of None means … the Renderer's window will be used”, but the types are non-optional. This impacts type-checkers and user code.

Apply this diff to align type hints and setter:

-    def target(self) -> "Texture":
+    def target(self) -> Optional["Texture"]:
@@
-    def target(self, value: "Texture") -> None: ...
+    def target(self, value: Optional["Texture"]) -> None: ...
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def target(self) -> "Texture":
"""Get or set the current rendering target
Gets or sets the current rendering target.
A value of ``None`` means that no custom rendering target was set and the
Renderer's window will be used as the target.
.. versionadded:: 2.5.4
"""
@target.setter
def target(self, value: "Texture") -> None: ...
def target(self) -> Optional["Texture"]:
"""Get or set the current rendering target
Gets or sets the current rendering target.
A value of ``None`` means that no custom rendering target was set and the
Renderer's window will be used as the target.
.. versionadded:: 2.5.4
"""
@target.setter
def target(self, value: Optional["Texture"]) -> None: ...
🤖 Prompt for AI Agents
In buildconfig/stubs/pygame/_render.pyi around lines 267 to 277, the annotated
types for Renderer.target are non-optional but the docstring states None is a
valid value; update the type hints to Optional["Texture"] for both the getter
return and the setter parameter and ensure typing.Optional is imported (or add
from typing import Optional at top of the stub) so static type-checkers accept
None as a valid value.

@@ -1,6 +1,7 @@
import autoapi
import autoapi.documenters
from autoapi._objects import PythonClass
from autoapi._mapper import PythonModule
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Avoid hard failing on AutoAPI internals import across versions.

from autoapi._mapper import PythonModule is a private import and may not exist across AutoAPI versions. Wrap it to degrade gracefully.

Apply this diff:

-from autoapi._mapper import PythonModule
+try:
+    from autoapi._mapper import PythonModule as _PythonModule
+except Exception:
+    _PythonModule = None  # AutoAPI version without _mapper.PythonModule
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
from autoapi._mapper import PythonModule
try:
from autoapi._mapper import PythonModule as _PythonModule
except Exception:
_PythonModule = None # AutoAPI version without _mapper.PythonModule
🤖 Prompt for AI Agents
In docs/reST/ext/documenters.py around line 4, the direct private import from
autoapi._mapper may not exist across AutoAPI versions; change it to attempt
importing PythonModule in a try/except ImportError block and fall back
gracefully (either import the public equivalent if available or set PythonModule
to None/a sentinel), and ensure any later use of PythonModule checks for the
fallback before using it so the module degrades without hard failing.

Copy link
Contributor

@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

♻️ Duplicate comments (6)
buildconfig/stubs/pygame/_render.pyi (6)

101-102: Grammar: “cannot shared” → “cannot be shared”.

-        .. note:: Textures created by different Renderers cannot shared with each other!
+        .. note:: Textures created by different Renderers cannot be shared with each other!

129-133: Fix parameter names in draw_quad docs (p3/p4 mislabelled).

         :param p1: The first quad point.
         :param p2: The second quad point.
-        :param p2: The third quad point.
-        :param p2: The fourth quad point.
+        :param p3: The third quad point.
+        :param p4: The fourth quad point.

148-151: Fix parameter name in draw_triangle docs (p3 mislabelled).

         :param p1: The first triangle point.
         :param p2: The second triangle point.
-        :param p2: The third triangle point.
+        :param p3: The third triangle point.

158-162: Fix parameter names in fill_quad docs (p3/p4 mislabelled).

         :param p1: The first quad point.
         :param p2: The second quad point.
-        :param p2: The third quad point.
-        :param p2: The fourth quad point.
+        :param p3: The third quad point.
+        :param p4: The fourth quad point.

177-180: Fix parameter name in fill_triangle docs (p3 mislabelled).

         :param p1: The first triangle point.
         :param p2: The second triangle point.
-        :param p2: The third triangle point.
+        :param p3: The third triangle point.

265-275: Type mismatch vs. docs: target should accept/return Optional[Texture].

Docs state None is valid; update the annotations accordingly for type-checker correctness.

-    def target(self) -> "Texture":
+    def target(self) -> Optional["Texture"]:
@@
-    def target(self, value: "Texture") -> None: ...
+    def target(self, value: Optional["Texture"]) -> None: ...
🧹 Nitpick comments (6)
buildconfig/stubs/pygame/_render.pyi (6)

96-100: Expand blit() docs to reflect accepted _DrawableClass sources and tighten “special_flags” phrasing.

The signature accepts any object implementing draw(area, dest), but the docs only mention Texture/Image. Also, clarify that special_flags are currently ignored.

-        :param source: A :class:`Texture` or :class:`Image` to draw.
+        :param source: A :class:`Texture`, :class:`Image`, or any object implementing a ``draw(area, dest)`` method.
@@
-        :param special_flags: have no effect at this moment.
+        :param special_flags: Currently ignored; has no effect.

191-197: De-duplicate present() docstring.

Same sentence appears twice. Tighten to a single summary.

-        """Update the screen with any rendering performed since the previous call
-
-        Presents the composed backbuffer to the screen.
-        Updates the screen with any rendering performed since the previous call.
+        """Present the composed backbuffer to the window (updates the screen).
 
         .. versionadded:: 2.5.4
         """

219-223: Docstring param style: drop the duplicated type in “:param Surface surface:”.

Sphinx picks types from annotations; keep “:param surface:” for consistency with the rest of the file.

-        :param Surface surface: A :class:`pygame.Surface` object to read the pixel
+        :param surface: A :class:`pygame.Surface` object to read the pixel

257-261: scale property can be set; reflect that in the doc.

-        """Get the drawing scale for the current rendering target
+        """Get or set the drawing scale for the current rendering target

277-283: Prefer @staticmethod for compose_custom_blend_mode to match _sdl2.video.

No class state is used; aligning the decorator and signature improves parity.

-    @classmethod
-    def compose_custom_blend_mode(
-        cls, color_mode: SequenceLike[int], alpha_mode: SequenceLike[int]
+    @staticmethod
+    def compose_custom_blend_mode(
+        color_mode: SequenceLike[int], alpha_mode: SequenceLike[int]
     ) -> int:

288-289: Fix return doc to reference properties, not non-existent setters.

There are no set_draw_blend_mode/set_blend_mode methods here; these are properties.

-        :return: A blend mode to be used with :meth:`Renderer.set_draw_blend_mode` and :meth:`Texture.set_blend_mode`.
+        :return: A blend mode to be used with :attr:`Renderer.draw_blend_mode` and :attr:`Texture.blend_mode`.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between fb62f5b and 4ad43d6.

📒 Files selected for processing (1)
  • buildconfig/stubs/pygame/_render.pyi (4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
buildconfig/stubs/pygame/_render.pyi (1)
buildconfig/stubs/pygame/_sdl2/video.pyi (23)
  • clear (144-144)
  • draw_line (160-160)
  • draw_point (161-161)
  • draw_quad (87-101)
  • draw_quad (166-166)
  • draw_rect (162-162)
  • draw_triangle (75-86)
  • draw_triangle (164-164)
  • fill_quad (167-167)
  • fill_rect (163-163)
  • fill_triangle (165-165)
  • get_viewport (146-146)
  • present (145-145)
  • set_viewport (147-147)
  • coordinates_to_window (149-149)
  • coordinates_from_window (150-150)
  • to_surface (168-170)
  • draw_color (141-141)
  • draw_color (143-143)
  • compose_custom_blend_mode (172-174)
  • from_window (138-138)
  • Renderer (128-174)
  • Texture (42-102)
⏰ 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). (8)
  • GitHub Check: build (ubuntu-24.04)
  • GitHub Check: msys2 (clang64, clang-x86_64)
  • GitHub Check: i686
  • GitHub Check: x86
  • GitHub Check: AMD64
  • GitHub Check: x86_64
  • GitHub Check: debug_coverage (ubuntu-24.04, 3.13.5)
  • GitHub Check: debug_coverage (ubuntu-24.04, 3.14.0rc1)
🔇 Additional comments (1)
buildconfig/stubs/pygame/_render.pyi (1)

47-74: Nice docs port and API parity with _sdl2.video.

Good coverage and helpful context in the class-level docstring; the initialization signature and method surface align well with _sdl2.video. This should make progressive documentation easier to land.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs _sdl2 pygame._sdl2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants