docs: Remove duplicate type hints in docstrings and annotations#2483
docs: Remove duplicate type hints in docstrings and annotations#2483MortGron wants to merge 7 commits intopysdk-release-v8from
Conversation
erlendvollset
left a comment
There was a problem hiding this comment.
I think most (sane) modern tooling relies on signature annotations, so this is a good change.
@haakonvt does this affect the v8 sync app generator?
I think it should still work! |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## pysdk-release-v8 #2483 +/- ##
====================================================
- Coverage 93.41% 93.41% -0.01%
====================================================
Files 478 478
Lines 48217 48230 +13
====================================================
+ Hits 45044 45054 +10
- Misses 3173 3176 +3
🚀 New features to boost your workflow:
|
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request aims to declutter the codebase by removing redundant type hints from docstrings. By relying on Python type annotations instead, the documentation becomes cleaner and easier to maintain. A Sphinx extension is enabled to ensure that type information remains present in the generated documentation, maintaining the same level of detail for end-users. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request performs a large-scale cleanup of docstrings across the SDK by removing redundant type information from the 'Args' and 'Returns' sections. This change shifts the source of truth for type information to the Python type hints in the function signatures, improving maintainability. Additionally, the pre-commit configuration for darglint has been updated to disable checks for these docstring type hints. I have no feedback to provide.

Description
The duplication of type hints in both docstring and as annotations makes the docstrings unnecessarily hard to read as a developer. It is possible to remove type hints in the docstrings without changing the structure of the documentation. This PR removes all type hints from the docstrings, but enables a Sphinx extension to keep the type hints in the documentation.
Current documentation:
New documentation:
A few points to discuss:
Checklist:
If a new method has been added it should be referenced in cognite.rst in order to generate docs based on its docstring.