Skip to content

Commit da2b106

Browse files
committed
Add: doc
1 parent ea7c66c commit da2b106

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

doc/deprecation.md

+25
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,31 @@ def example_function(n_clusters=10, another=42, k="deprecated"):
498498
example_function(k=10)
499499
```
500500

501+
## Deprecation warning with logger
502+
503+
`deprecation_warning(telemetry, message)` is designed to facilitate the logging of deprecated features in your codebase. It throws warning messages and log
504+
the information about the name deprecated feature, the package name and version.
505+
506+
We need to provide telemetry instance and the message string
507+
508+
- telemetry, [Telemetry class](https://ploomber-core--65.org.readthedocs.build/en/65/telemetry.html)
509+
- message, str, the message to display
510+
511+
### Example
512+
513+
In the jupysql project, we may import the existing telemetry instance and pass to `deprecation_warning`
514+
515+
```
516+
from sql.telemetry import telemetry
517+
518+
def some_random_func():
519+
deprecation_warning(telemetry, "you are using old feature")
520+
521+
some_random_func()
522+
```
523+
524+
The message `you are using old feature` and jupysql package info will be logged
525+
501526
## Reference
502527

503528
This is based on [sklearn's guidelines.](https://scikit-learn.org/stable/developers/contributing.html#maintaining-backwards-compatibility)

0 commit comments

Comments
 (0)