Skip to main content

Мощная библиотека для отладки Python-кода с глобальным перехватом ошибок

Project description

# Nano-Python-Debug

Ультимативная библиотека для отладки Python-кода. Главная фишка: **CMD не закрывается при ошибке** – вы увидите стек и сможете перезапустить скрипт.

## Установка

pip install Nano-Python-Debug

Использование

1\. Глобальный перехват ошибок (самое важное!)

python

from nano\_debug import enable\_global\_catch



enable\_global\_catch()  # после этого CMD не закроется при любой ошибке



\# ваш код

x = 1 / 0  # ошибка, но консоль не закроется

2\. Декоратор отладки функции

python

from nano\_debug import debug\_func



@debug\_func

def my\_func(a, b):

    return a / b

3\. Трассировка вызовов

python

from nano\_debug import trace\_calls



@trace\_calls

def factorial(n):

&#x20;   if n <= 1: return 1

&#x20;   return n \* factorial(n-1)

4\. Точка останова

python

from nano\_debug import breakpoint\_here



x = 42

breakpoint\_here()  # откроется интерактивная консоль с доступом к переменным

5\. Просмотр переменных

python

from nano\_debug import watch\_variable, inspect\_variables



my\_var = \[1,2,3]

watch\_variable(my\_var, "my\_var")  # или просто watch\_variable(my\_var)

inspect\_variables()

Лицензия

MIT



text



\## 🚀 Установка и использование



1\. Установите библиотеку:

&#x20;  ```bash

&#x20;  pip install Nano-Python-Debug

В вашем скрипте в самом начале добавьте:



python

from nano\_debug import enable\_global\_catch

enable\_global\_catch()

Теперь даже при необработанной ошибке консоль не закроется  вы увидите стек и сможете перезапустить скрипт, нажав r.



🧪 Пример

python

from nano\_debug import enable\_global\_catch, debug\_func



enable\_global\_catch()



@debug\_func

def divide(a, b):

&#x20;   return a / b



divide(10, 0)  # ошибка, но консоль не закрывается

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nano_python_debug-1.0.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file nano_python_debug-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nano_python_debug-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1e8b7136552bebad0cfd77fb14e20f98573fbf1e89f581feec4f7110ae192164
MD5 0bb2eacbbe773c4ce634f9e64e323f9a
BLAKE2b-256 2b31bad0cb7bc220517be40e8703e140dc4625b9841704dfb05fe6cfcd1751d6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page