pingcap / pingcap/tidb

Add type hints to public API functions

Open
#69,682 0 comments 0 reactions 0 assignees View on GitHub
contribution
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Feature Request

### Summary
Adding type hints to public API functions would significantly improve developer experience and enable better tooling support.

### Motivation
- IDEs can provide better autocomplete and inline documentation
- Static type checkers like `mypy` can catch bugs before runtime
- New contributors can understand the expected inputs/outputs faster
- Type hints serve as machine-checked documentation

### Proposed Change
Add type annotations to all public functions:

```python
# Before:
def process(data, config=None):
...

# After:
from typing import Optional, Dict, Any

def process(data: Dict[str, Any], config: Optional[Dict] = None) -> bool:
...
```

### Additional Context
This is a non-breaking change and can be done incrementally, starting with the most-used public functions.

Contributor guide

Open the contributing guide

Research direction

The issue names no repository files, tests, or public API entry points; start by checking whether this Go repository contains the Python API shown in the example and identifying the intended API surface. Done would require an agreed, complete scope for annotations and a way to verify that the public functions are typed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.