mailbox: document Message vs EmailMessage situation
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 36k
- PR 合并指标
- PR 指标待抓取
描述
Documentation
If I read the email documentation, it makes a clear case for staying away from email.Message:
The foregoing represent the modern (unicode friendly) API of the email package. The remaining sections, starting with the Message class, cover the legacy compat32 API that deals much more directly with the details of how email messages are represented. The compat32 API does not hide the details of the RFCs from the application, but for applications that need to operate at that level, they can be useful tools. This documentation is also relevant for applications that are still using the compat32 API for backward compatibility reasons.
Changed in version 3.6: Docs reorganized and rewritten to promote the new EmailMessage/EmailPolicy API.
And indeed, there are common tasks that are hard to do in email.Message and easy with EmailMessage (see get_body() for a very common use case).
However in the documentation of mailbox, email.Message is mentioned like it's the standard.
Since at the moment in the standard library, with regards to email handling, the rule "There should be one-- and preferably only one --obvious way to do it." seems to be violated, and there are several classes with confusingly similar names but very different roles (mailbox.Message, email.Message, email.message.EmailMessage) it would help to have a clarification of the situation in the documentation of mailbox, at least until #77156 happens.
I don't know enough of the background that led to this situation to be able to draft a serious proposal for the documentation, but I guess something along the lines of this could be an initial draft:
There are currently two distinct classes for handling emails:
email.Message(deprecated), andemail.message.EmailMessage. The latter is more featureful and easier to use, but themailboxmodule still has not been updated to transition to it.
mailboxsubclasses the deprecatedemail.Messageasmailbox.Message, to act as the base hierarchy for messages read from mailboxes.
It is expected thatmailbox.Messagewill become a subclass ofemail.message.EmailMessagein a future version of Python [insert API compatibility notes].
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 mailbox 模块文档开始,将其中对 email.Message 的引用与 email 包中关于 EmailMessage 和 compat32 API 的文档进行比较。审查 mailbox.Message、email.Message 和 email.message.EmailMessage 之间的关系,然后在 mailbox 文档中阐明它们各自的作用和迁移状态。当文档解释应用程序应使用哪个类,以及 mailbox 为什么仍然公开旧版层次结构时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- documentation
- Issue 类型
- 文档
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100