hartwork / import-watch

Trace module imports and detect/deny cyclic imports at runtime

Home Page:https://pypi.org/project/import-watch/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Welcome!

import-watch allows to trace module imports and detect/deny cyclic imports at runtime with Python 2 and 3. It is licensed under the MIT license.

Enjoy!

Installation

# pip install import-watch

Usage

Trace imports

import import_watch
import_watch.trace_imports(depth=2)  # default depth is unlimited

Detect and warn about cyclic imports (at runtime)

import import_watch
import_watch.warn_about_cyclic_imports()

Deny cyclic imports (at runtime)

import import_watch
import_watch.deny_cyclic_imports()

Start fresh

import import_watch
[..]
import_watch.reset()

About

Trace module imports and detect/deny cyclic imports at runtime

https://pypi.org/project/import-watch/


Languages

Language:Python 100.0%