DHI / DHI/python-package-development

Add content on deprecating functionality

未关闭
#33 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Jupyter Notebook
星标
8
派生
1
平均合并
4 分钟
30 天内合并 PR
1

描述

## Problem
The course covers semantic versioning and breaking changes in Module 7, but lacks content on **deprecation strategies** - a critical skill for package maintainers.

## Proposed Content

Add a section to Module 7 (`07_packaging.qmd`) covering:

### 1. Deprecation Warnings
- Using Python's `warnings` module
- Proper `stacklevel` usage
- **DeprecationWarning vs FutureWarning**:
- `DeprecationWarning`: For developers (filtered by default, shown when running tests)
- `FutureWarning`: For end users (always visible, for changes affecting user code)

### 2. Deprecation Timeline
- Announce in version X.Y
- Remove in version (X+1).0
- Maintain for 1-2 minor releases minimum

### 3. Communication Strategy
- CHANGELOG updates
- Release notes
- Documentation migration guides
- Clear docstring warnings

### 4. Code Examples
```python
import warnings

def old_function(x):
warnings.warn(
"old_function is deprecated and will be removed in version 2.0. "
"Use new_function instead.",
DeprecationWarning,
stacklevel=2
)
return new_function(x)
```

### 5. Real-World Examples
Reference deprecation practices from popular packages (pandas, numpy, scikit-learn).

## Location
Module 7 - after the "Breaking changes" section (around line 132)

贡献指南

这个仓库没有索引到贡献指南

调研方向

Open Module 7 in 07_packaging.qmd and read the existing “Breaking changes” section around line 132. Add a focused section covering warning types and stacklevel, a deprecation timeline, communication practices, code and real-world examples. Done means the module explains these strategies clearly and fits the surrounding course content.

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

评估

技术栈
python
领域
documentation
Issue 类型
文档
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
52/100

把新 issue 发到你的邮箱

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