https://github.com/luizfilipezs/lets-debug
Public pip package written in Python for debugging code using terminal or cmd.
https://github.com/luizfilipezs/lets-debug
debugging-tools pip python3
Last synced: 7 months ago
JSON representation
Public pip package written in Python for debugging code using terminal or cmd.
- Host: GitHub
- URL: https://github.com/luizfilipezs/lets-debug
- Owner: luizfilipezs
- License: mit
- Created: 2020-06-07T07:35:13.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-13T20:51:10.000Z (over 5 years ago)
- Last Synced: 2025-06-17T18:19:17.400Z (7 months ago)
- Topics: debugging-tools, pip, python3
- Language: Python
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lets-debug
[](https://pypi.org/project/lets-debug/)
## Introduction
This package allows you to debug your Python code using terminal tools.
## Installation
`pip install lets-debug`
### Imports
```python
from lets_debug import terminal, DecoratorTools
```
## Reference
### `terminal`
These are the available methods from `terminal`:
#### `log(*args)`
Prints every element passed in `*args` using blue color.
#### `warn(*args)`
Prints every element passed in `*args` using orange color.
#### `error(*args)`
Prints every element passed in `*args` using red color.
#### `success(*args)`
Prints every element passed in `*args` using green color.
#### `clear()`
Clear terminal or command prompt screen.
#### `count(name='counter')`
Counts number of times that `name` was called using this method. It is useful for couting number of times that a function is called. See the example bellow:
```python
def greet():
terminal.log('Welcome!')
terminal.count('greet')
greet()
greet()
```
The output will be:
```bash
greet: 1
greet: 2
```
#### `check_bool(boolean: bool, callback: Any)`
Prints `callback` if `boolean` is `False`.
#### `table(dictionary_list: List[Dict])`
Prints `dictionary_list` as table.
### `DecoratorTools`
These are the available methods from `DecoratorTools` class (all methods are static):
#### `log(*args, type='log')`
Prints every element passed in `*args` using custom color. `type` argument defines the color. The available types are `'log'`, `'warn'`, `'error'`, and `'success'`.
#### `count(*args)`
Counts number of times that a function was called.
#### `stopwatch(*args)`
Counts how long a function takes to run.
#### `override(*args, **kwargs)`
Check if the current method exists in its parent object. See the example bellow:
```python
from lets_debug import DecoratorTools as debug
class Human:
def walk(self):
terminal.log('Human is walking...')
class Person(Human):
@debug.override
def walk(self):
terminal.log('Person is walking...')
```
This code is OK. But if you remove `walk()` from `Human` class, an error message will appear in the output.
If you want the program to stop in this situations, set `get_error` option to `True`:
```python
@debug.override(get_error=True)
def walk(self):
```
## Contributions
Feel free to use this package and to contribute on this repository with your ideas!