Skip to main content

A library extracting dependencies between statements in Python program.

Project description

Stmdency

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

stmdency, statement dependency is a Python library for extracting dependencies between statements in a Python program.

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?

Project details


Download files

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

Source Distribution

stmdency-0.0.5.tar.gz (9.0 kB view hashes)

Uploaded Source

Built Distribution

stmdency-0.0.5-py3-none-any.whl (8.4 kB view hashes)

Uploaded Python 3

Supported by

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