Add helper to deprecate a module.
- Dominant language
- Python
- Stars
- 15
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
A warning for a module deprecation can be emitted at first import.
A package is just a module.
The important help is to make know exactly which module is deprecated (`__name__`) and where it is used (`stacklevel=2`).
And the message should be standardized.
See if `__name__` can be used to reduce boilerplate.
This is a generic helper to raise a deprecation event based right when it is called.
Example from current implementation twisted/mail/pop3client.py
```python
warnings.warn(
"twisted.mail.pop3client was deprecated in Twisted NEXT. Use twisted.mail.pop3 instead.",
DeprecationWarning,
stacklevel=2,
)
```
The API might look like
```python
regret.module(
version='1.2.3',
target=__name__,
replacement='twisted.mail.pop3',
)
```
Maybe even try to be smart and go up the stack to extract `__name__`.
Then in the most simple case we will have:
```python
regret.module(version='1.2.3')
```
Contributor guide
Assessment
This issue has not been assessed yet.