docs: add Raises sections to client docstrings (fixes #348)#1185
docs: add Raises sections to client docstrings (fixes #348)#1185Muhammad-Danyal353 wants to merge 4 commits intoqdrant:devfrom
Conversation
✅ Deploy Preview for poetic-froyo-8baba7 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR updates the public sync and async Qdrant client docstrings to explicitly document exceptions that can be raised at runtime, improving API error discoverability (fixes #348).
Changes:
- Added
Raises:sections to client constructors and gRPC/REST accessors to documentValueError/NotImplementedError. - Added
Raises:sections to many public client methods to document the current “unknown**kwargs” failure behavior. - Documented additional
ValueErrorcases for specific methods (e.g.,update_collection,migrate).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
qdrant_client/qdrant_client.py |
Adds Raises: sections across the sync client’s public surface area (constructor, accessors, and many methods). |
qdrant_client/async_qdrant_client.py |
Mirrors the same Raises: documentation updates for the async client methods and accessors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe pull request expands Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
qdrant_client/qdrant_client.py (1)
263-265: Replaceassertvalidation with explicit exception for public API kwargs.The assertion at line 266 (
assert len(kwargs) == 0) can be silently disabled when Python runs with optimizations (python -O), breaking the documentedAssertionErrorcontract. Use explicit validation instead:if kwargs: raise TypeError(f"Unknown arguments: {list(kwargs.keys())}")and update the docstring accordingly.This pattern appears in 46 methods across the file and should be refactored consistently.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@qdrant_client/qdrant_client.py` around lines 263 - 265, Several public API methods (e.g., functions that currently use assert len(kwargs) == 0) must replace the assert with explicit validation to avoid being bypassed under python -O; locate each occurrence (about 46 methods in qdrant_client.py) and change the pattern to: if kwargs: raise TypeError(f"Unknown arguments: {list(kwargs.keys())}"), and update the corresponding docstring Raises: section to reflect TypeError instead of AssertionError; ensure you update all functions using assert len(kwargs) == 0 (search for that exact expression) and keep behavior and message consistent across methods.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@qdrant_client/qdrant_client.py`:
- Around line 263-265: Several public API methods (e.g., functions that
currently use assert len(kwargs) == 0) must replace the assert with explicit
validation to avoid being bypassed under python -O; locate each occurrence
(about 46 methods in qdrant_client.py) and change the pattern to: if kwargs:
raise TypeError(f"Unknown arguments: {list(kwargs.keys())}"), and update the
corresponding docstring Raises: section to reflect TypeError instead of
AssertionError; ensure you update all functions using assert len(kwargs) == 0
(search for that exact expression) and keep behavior and message consistent
across methods.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 9e8102e4-c562-4b33-8423-553463b1f50f
📒 Files selected for processing (2)
qdrant_client/async_qdrant_client.pyqdrant_client/qdrant_client.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Summary
This PR adds explicit Raises sections to public client docstrings to improve API error discoverability and align documentation with actual runtime behavior.
Scope of updates:
Why
Issue #348 requests documenting exceptions in docstrings. This change makes expected failures clearer for users and improves IDE/help output quality.
Validation
Checklist
All Submissions:
New Feature Submissions:
Changes to Core Features: