DHI / DHI/python-package-development

Add content on deprecating functionality

Đang mở
#33 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Jupyter Notebook
Star
8
Fork
1
Merge trung bình
4 phút
Pull request đã merge (30 ngày)
1

Mô tả

## 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)

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
documentation
Loại issue
Tài liệu
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
52/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.