Add support for marking classes `typing.final`
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- python
调研方向
Start by reviewing the public frozen, define, and mutable decorator APIs and the question of how they should interact with typing.final. The issue leaves defaults, backward compatibility, subclassing behavior, and deprecation options unresolved. Done would require an agreed design before implementation scope can be defined.
由索引模型根据 Issue 内容生成。
描述
I am filing the below not really having through details, though I at least don't see this mentioned in any other issue, hence splatting it out :). Spicy takes I'm sure coming below as I'm sure part of this rests on how much each of us tolerates inheritance.
Should attrs have a way to apply typing.final to its classes so that they're easier to mark as "don't subclass"? E.g. a final= argument to frozen / define / mutable?
Obviously stacking the two decorators works, so the motivation I guess for me personally is just "I always want final for basically any class I expose", so if attrs had this it's one less thing to forget. What I do now is usually things at runtime, which don't use final() at all, but given I just realized I should probably add final() too so that users who do rely on their type checkers see a warning, that made me wonder whether that half is something general enough to be here.
If it were an argument to define, defaulting to True obviously breaks backwards compatibility. Perhaps doing it for frozen at least is justifiable? Or at least desirable with a deprecation warning for subclassing in the interim?
Any thoughts on how reasonable that sounds?
- 主要语言
- Python
- 星标
- 5.9k
- 派生
- 503
- 平均合并
- 4 天 18 小时
- 30 天内合并 PR
- 5
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
python-attrs/attrs 的其他 Issue
-
Docs: `attrs.filters` is missing stated examples可能已有人在做 @feiiiiii5 于 24 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
python-attrs/attrs#1627 ·
维护者通常 2 天内回复
-
slots declared on attrs-decorated class are ignored/lost可能已有人在做 @anshurajbisoyi98-ctrl 于 16 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 68/100
python-attrs/attrs#1637 ·
维护者通常 2 天内回复
-
难度 5/5 一周以上 新手友好度 20/100
python-attrs/attrs#1620 ·
维护者通常 2 天内回复
-
Incorrect annotation for forward reference in generated constructor可能已有人在做 @MohammedAnasNathani 于 81 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 55/100
python-attrs/attrs#1596 · 2 条评论 · 2 个 reaction ·
维护者通常 2 天内回复
-
Decorated functions do not work with inheritance可能已有人在做 @sb123sb123 于 28 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
python-attrs/attrs#1549 · 3 条评论 ·
维护者通常 2 天内回复
查看 python-attrs/attrs 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 79/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
mohitmishra786/readprism#322 ·
维护者通常 1 天内回复
-
good first issue
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 1/5 1 小时以内 新手友好度 75/100
维护者通常 1 天内回复
-
API-key credentials accept a blank key: empty via the API, spaces-only via the builder's Add API key dialog可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 77/100
Significant-Gravitas/AutoGPT#15727 ·
维护者通常 1 天内回复