Skip to content

Latest commit

 

History

History
69 lines (48 loc) · 2.33 KB

README.md

File metadata and controls

69 lines (48 loc) · 2.33 KB

Stmdency

PyPi Version PyPi Python Versions PyPi License PyPi Status Downloads Coverage Status Code style: black CI Documentation Status

Stmdency, STateMent depenDENCY is a Python library for extracting dependencies between Python statements.

Installation

python -m pip install --upgrade stmdency

Usage

Let's say we have a Python script named test.py with the following content:

a = 1
b = 2

def bar():
   b = a + 3
   print(a, b)

def foo():
   bar(b)

We want to extract function foo and all its dependencies. stmdency can do this for us:

from stmdency.extractor import Extractor

with open("test.py", "r") as f:
   source = f.read()
   extractor = Extractor(source)
   print(extractor.get_code("foo"))

The output will be:

a = 1

def bar():
    b = a + 3
    print(a, b)

b = 2

def foo():
    bar(b)

Documentation

The documentation host read the doc and is available at https://stmdency.readthedocs.io.

Who is using stmdency?