Skip to content

Codex/set up mkdocs documentation structure#107

Merged
ybrs merged 3 commits intomainfrom
codex/set-up-mkdocs-documentation-structure
Oct 14, 2025
Merged

Codex/set up mkdocs documentation structure#107
ybrs merged 3 commits intomainfrom
codex/set-up-mkdocs-documentation-structure

Conversation

@ybrs
Copy link
Copy Markdown
Owner

@ybrs ybrs commented Oct 14, 2025

Summary by CodeRabbit

  • Documentation

    • Clarified parameter and return descriptions across the public API.
    • Expanded docstrings with clearer terminology and an example for data→Arrow conversion.
    • Improved wording around TLS setup and connection handling.
  • Refactor

    • Added comprehensive type annotations to public interfaces for better IDE support and readability.
    • Standardized method signatures for authentication, connect/query/disconnect flows.
    • No functional behavior changes.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Oct 14, 2025

Walkthrough

Updated type annotations and method signatures in pysrc/riffq/connection.py and pysrc/riffq/helpers.py, plus docstring/comment adjustments; no behavioural or control-flow changes were introduced. (50 words)

Changes

Cohort / File(s) Summary of Changes
Connection API typing updates
pysrc/riffq/connection.py
Added explicit type hints to BaseConnection and RiffqServer constructors and methods (parameters and return types), formalized callbacks and optional args, and adjusted docstrings/comments to match new signatures.
Helpers to_arrow annotations
pysrc/riffq/helpers.py
Annotated to_arrow(schema_desc: list[dict], rows: list) -> 'pa._ffi.lib.PyCapsule', expanded the docstring with usage/example; implementation unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • Duckdb catalog server #70 — Related changes to connection and server API signatures that affect Connection subclasses and server usage.

Poem

I nibble on types in a meadow of defs,
Carrots of hints in my whiskered clefs.
No logic hops — just annotations neat,
A tidy trail where APIs meet.
Thump-thump! The server smiles, arrow bright. 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The current title refers to setting up MkDocs documentation, but the actual changeset adds explicit type annotations and adjusts public API method signatures in the connection and helper modules, so the title does not accurately describe the primary changes. Please update the pull request title to clearly reflect the addition of type hints and API signature updates in connection.py and helpers.py, for example “Add explicit type annotations to Riffq connection and helper modules.”
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/set-up-mkdocs-documentation-structure

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 27faf9e and db3bc62.

📒 Files selected for processing (1)
  • pysrc/riffq/helpers.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • pysrc/riffq/helpers.py
⏰ 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). (2)
  • GitHub Check: unit-tests
  • GitHub Check: unit-tests

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
Copy Markdown
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: 2

🧹 Nitpick comments (1)
pysrc/riffq/connection.py (1)

149-149: Add spaces around colons in type annotations.

The type hints are missing spaces after the colons, which is inconsistent with PEP 8 style guidelines.

Apply this diff:

-    def set_tls(self, crt:str, key:str):
+    def set_tls(self, crt: str, key: str):
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 706f77e and 27faf9e.

📒 Files selected for processing (2)
  • pysrc/riffq/connection.py (16 hunks)
  • pysrc/riffq/helpers.py (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
pysrc/riffq/connection.py (2)
src/lib.rs (3)
  • set_tls (1677-1685)
  • register_table (1695-1729)
  • start (1733-1737)
tests/test_connection_id.py (1)
  • handle_query (19-30)
🪛 GitHub Actions: CI
pysrc/riffq/helpers.py

[error] 21-21: AttributeError: module 'pyarrow' has no attribute '_ffi' when defining to_arrow(schema_desc: list[dict], rows: list) -> pa._ffi.lib.PyCapsule.

🪛 Ruff (0.14.0)
pysrc/riffq/connection.py

80-80: Unused lambda argument: a

(ARG005)


80-80: Unused lambda argument: k

(ARG005)


92-92: Unused method argument: ip

(ARG002)


92-92: Unused method argument: port

(ARG002)


92-92: Unused lambda argument: a

(ARG005)


92-92: Unused lambda argument: k

(ARG005)


103-103: Unused lambda argument: a

(ARG005)


103-103: Unused lambda argument: k

(ARG005)


117-117: Unused method argument: ip

(ARG002)


117-117: Unused method argument: port

(ARG002)


117-117: Unused lambda argument: a

(ARG005)


117-117: Unused lambda argument: k

(ARG005)


212-212: Unused lambda argument: a

(ARG005)


212-212: Unused lambda argument: k

(ARG005)


227-227: Unused lambda argument: a

(ARG005)


227-227: Unused lambda argument: k

(ARG005)


253-253: Unused lambda argument: a

(ARG005)


253-253: Unused lambda argument: k

(ARG005)

⏰ 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: unit-tests
🔇 Additional comments (4)
pysrc/riffq/connection.py (4)

1-15: LGTM: Clear module-level documentation.

The updated module docstring provides a helpful overview of the two main concepts (BaseConnection and RiffqServer) and explains the callback pattern used throughout.


41-41: LGTM: Type annotations improve BaseConnection API clarity.

The added type hints across all BaseConnection methods make the interface contract explicit and will help with IDE autocomplete and type checking. The parameter and return types are accurate.

Also applies to: 45-45, 64-64, 80-80, 92-92, 103-103, 117-117


136-147: LGTM: Type annotations improve RiffqServer initialization.

The type hints on __init__ and instance variables clarify the expected types. The explicit Dict[int, BaseConnection] and Type[BaseConnection] annotations are particularly helpful for understanding the connection management pattern.


187-202: LGTM: Type annotations and docstring improvements.

The remaining method signatures now have clear type hints, and the docstrings have been updated to better describe parameters and behavior. The changes particularly improve clarity around:

  • register_table column descriptor format
  • Connection ID handling across forwarding methods
  • TLS and catalog emulation options in start

Also applies to: 204-210, 212-225, 227-238, 240-251, 253-268, 270-280

Comment thread pysrc/riffq/helpers.py Outdated

def to_arrow(schema_desc, rows):
"""Build an Arrow C Stream from schema and rows.
def to_arrow(schema_desc:list[dict], rows:list) -> pa._ffi.lib.PyCapsule:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Fix the invalid return type annotation.

The return type pa._ffi.lib.PyCapsule is invalid and causes the pipeline failure. PyArrow does not expose the _ffi.lib.PyCapsule path. The __arrow_c_stream__() method returns a PyCapsule object from Python's C API, which cannot be directly referenced as a type in this manner.

Apply this diff to use a valid type annotation:

-def to_arrow(schema_desc:list[dict], rows:list) -> pa._ffi.lib.PyCapsule:
+def to_arrow(schema_desc: list[dict], rows: list) -> Any:

Note: This also adds the missing spaces around : for PEP 8 compliance.

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 GitHub Actions: CI

[error] 21-21: AttributeError: module 'pyarrow' has no attribute '_ffi' when defining to_arrow(schema_desc: list[dict], rows: list) -> pa._ffi.lib.PyCapsule.

🤖 Prompt for AI Agents
In pysrc/riffq/helpers.py around line 21, the return type annotation
pa._ffi.lib.PyCapsule is invalid; change the signature to use a valid type
(e.g., from typing import Any and annotate the return as -> Any) and ensure
there is a space after the parameter names and before the type hints
(schema_desc: list[dict], rows: list) to satisfy PEP 8; also add the necessary
import for Any at the top of the file if not present.

Comment thread pysrc/riffq/helpers.py
Comment on lines +29 to +34
Example usage:
>>> callback(to_arrow([{"name": "val", "type": "int"}], [
[1],
[2]
]))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix the example indentation in the docstring.

The example code has incorrect indentation that makes it invalid Python syntax. List items should not be indented relative to the opening bracket.

Apply this diff to fix the indentation:

     Example usage:
-    >>> callback(to_arrow([{"name": "val", "type": "int"}], [
-        [1], 
-        [2]
-    ]))
+    >>> callback(to_arrow([{"name": "val", "type": "int"}], [[1], [2]]))
📝 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
Example usage:
>>> callback(to_arrow([{"name": "val", "type": "int"}], [
[1],
[2]
]))
Example usage:
>>> callback(to_arrow([{"name": "val", "type": "int"}], [[1], [2]]))
🤖 Prompt for AI Agents
In pysrc/riffq/helpers.py around lines 29 to 34, the docstring example has
mis-indented list items inside the bracket which makes the snippet invalid
Python; fix it by left-aligning the inner list items so they are not indented
relative to the opening bracket (i.e., remove the extra spaces before [1] and
[2]) so the example reads as a valid call to callback(to_arrow(..., [[1],
[2]])).

@ybrs ybrs merged commit bdc9516 into main Oct 14, 2025
3 checks passed
@ybrs ybrs deleted the codex/set-up-mkdocs-documentation-structure branch October 17, 2025 10:23
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.

1 participant