python / python/cpython

Replace deprecation lists in whatsnew files with tables

未关闭
#122,652 2 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

docs
主要语言
Python
星标
77.2k
派生
35.9k
PR 合并指标
PR 指标待抓取

描述

Documentation

The whatsnew files currently contain lists of removals, deprecations, and pending removals (see e.g. https://docs.python.org/3.13/whatsnew/3.13.html#new-deprecations). These tables are not particularly easy to navigate and take enough space (~1/3?) that they make the whatsnew itself difficult to navigate too.

I would consider replacing them with one or more tables.

The columns could include:

  1. the deprecated/removed API (which links to the API itself using :func:/:class:/:meth:/etc.)
  2. the version where the deprecation was introduced
  3. the version where the API is/will be removed (not needed if we have a separate table for each version)
  4. a link to the PR that introduced the deprecation
  5. possibly the contributor

The table won't contain the full description that explains why it was deprecated and how to replace it, making the table more compact and easier to navigate than the list we currently have. This will also saves us from (near) duplicating the description in both the .. deprecated:: directive in the modules pages and in the whatsnew.

Most deprecated APIs are seldomly used and don't affect many users. If they do, they are probably just a small fraction of all the deprecations, so all the text in the list is not particularly useful. It's also easier to run the code and see the deprecation warnings/errors or quickly scan a table than scanning a long list of deprecations.

The table is still convenient for checking if anything I'm using has been deprecated, for ctrl+f'ing deprecated APIs as I'm fixing them, for finding links to the APIs, and for reviewing the versions where they will be removed.

Some notes about using tables:

  • Some deprecation require short description (e.g. "Passing more than one positional argument to sqlite3.connect()"). There are possible solutions to this:
    • don't elaborate further and just link to the API that contains the deprecation notice
    • have a column for the "affect API" and a "note" column where to add a short description (if needed)
    • only use the tables for deprecated APIs, leaving the rest as a list
  • The name/link to the API already contains the module name, but a separate column for the module might be easier to read
  • If we have different tables depending on the version the APIs is being removed, then we won't need a column for it.
  • Like the lists, the tables can be included in multiple whatsnew files using include files (see #122085)

(cc @hugovk, @AA-Turner, @encukou)

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先检查 whatsnew 文件中的 deprecation、removal 和 pending-removal 列表,包括 3.13 页面,并研究 #122085 中引用的 include-file 方案。完成的标准是就表格结构达成一致,并在保留必要描述、API 链接和版本信息的同时一致地应用该结构。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
documentation
Issue 类型
文档
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。