Support Type Hints
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- python
调研方向
首先检查剩余的、尚未勾选的任务,以启用 Ruff 的 ANN 规则,并将其与 #2808 和 #2812 中已经完成的 Mypy 工作进行比较。完成意味着项目的类型提示政策已经确定,相关检查已启用,并且所需的注解通过了这些检查。
由索引模型根据 Issue 内容生成。
描述
This issue is still in draft mode. Type hints are something new to me, so I need to learn more and will keep improving the issue description.
What's Python's Type Hints
- A short introduction: https://vegibit.com/introduction-to-python-type-hints/
Why we should support type hints
Copied from https://vegibit.com/introduction-to-python-type-hints/.
- Improved code readability: Type hints make it easier for other developers to understand your code. By clearly specifying the types of arguments and return values, you can help others quickly grasp the intent of your code.
- Improved development speed: With type hints, you can catch potential bugs and errors early in the development process. This can save you time in the long run, as you can fix errors before they cause problems in your code.
- Improved tooling support: Many tools, such as static analyzers and IDEs, use type hints to provide better support for your code. For example, they can use type hints to catch potential errors, suggest code improvements, or provide better autocompletion.
- Better auto-completion for parameter values: See #2793 for how Type Hints can affect the way we use PyGMT.
Tasks
- Use Mypy for static type checking #2808
- #2812
- Enable ruff's
ANNrules to make sure all parameters are annotated? [Maybe it's unnecessary, because mypy has a strict mode]
References:
- https://docs.python.org/3/library/typing.html [TL;DR]
- https://typing.readthedocs.io/en/latest/source/libraries.html
- https://typing.readthedocs.io/en/latest/source/best_practices.html
- https://www.pythonlikeyoumeanit.com/Module5_OddsAndEnds/Writing_Good_Code.html#Type-Hinting
Related PEPs
- PEP 563: https://peps.python.org/pep-0563/
- PEP 484: https://peps.python.org/pep-0484/
- PEP 585: https://peps.python.org/pep-0585/
- PEP 604: https://peps.python.org/pep-0604/
- 主要语言
- Python
- 星标
- 882
- 派生
- 261
- 平均合并
- 1 天 3 小时
- 30 天内合并 PR
- 29
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
GenericMappingTools/pygmt 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
GenericMappingTools/pygmt#5014 · 1 条评论 ·
维护者通常 1 天内回复
-
discussions documentation
难度 1/5 1 小时以内 新手友好度 78/100
GenericMappingTools/pygmt#4992 ·
维护者通常 1 天内回复
-
Improve reporting the GMT version via "pygmt.show_versions()"可能已有人在做 @yvonnefroehlich 于 113 天前认领。 未关闭maintenance
难度 2/5 1-3 小时 新手友好度 68/100
GenericMappingTools/pygmt#4812 · 4 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 64/100
GenericMappingTools/pygmt#4765 ·
维护者通常 1 天内回复
-
Add an AGENTS.md file可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭discussions
难度 2/5 1-3 小时 新手友好度 75/100
GenericMappingTools/pygmt#4677 · 2 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
查看 GenericMappingTools/pygmt 的全部 Issue
相似的 Issue
-
DMB documentation good first issue help wanted
难度 2/5 1-3 小时 新手友好度 76/100
ubuntu/ubuntu-project-docs#921 ·
维护者通常 1 天内回复
-
⏳ Pending feedback 🐛 Bug
难度 2/5 1-3 小时 新手友好度 70/100
jumpserver/jumpserver#18282 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 76/100
ClickHouse/loom#2014 ·
维护者通常 1 天内回复
-
accepted
难度 2/5 1-3 小时 新手友好度 67/100
future-agi/future-agi#5274 ·
维护者通常 1 天内回复
-
needs-triage
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 2 天内回复