# Stmdency
[![PyPi Version](https://img.shields.io/pypi/v/stmdency.svg?style=flat-square&logo=PyPi)](https://pypi.org/project/stmdency/)
[![PyPi Python Versions](https://img.shields.io/pypi/pyversions/stmdency.svg?style=flat-square&logo=python)](https://pypi.org/project/stmdency/)
[![PyPi License](https://img.shields.io/:license-Apache%202-blue.svg?style=flat-square)](https://raw.githubusercontent.com/zhongjiajie/stmdency/main/LICENSE)
[![PyPi Status](https://img.shields.io/pypi/status/stmdency.svg?style=flat-square)](https://pypi.org/project/stmdency/)
[![Downloads](https://pepy.tech/badge/stmdency/month)](https://pepy.tech/project/stmdency)
[![Coverage Status](https://img.shields.io/codecov/c/github/zhongjiajie/stmdency/main.svg?style=flat-square)](https://codecov.io/github/zhongjiajie/stmdency?branch=main) <!-- markdown-link-check-disable-line -->
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat-square&labelColor=ef8336)](https://pycqa.github.io/isort)
[![CI](https://github.com/zhongjiajie/stmdency/actions/workflows/ci.yaml/badge.svg)](https://github.com/zhongjiajie/stmdency/actions/workflows/ci.yaml)
[![Documentation Status](https://readthedocs.org/projects/stmdency/badge/?version=latest)](https://stmdency.readthedocs.io/en/latest/?badge=latest)
stmdency, **sta**tement depen**dency** is a Python library for extracting dependencies between statements in a Python program.
## Installation
```shell
python -m pip install --upgrade stmdency
```
## Usage
Let's say we have a Python script named `test.py` with the following content:
```python
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:
```python
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:
```python
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](https://stmdency.readthedocs.io).
## Who is using stmdency?
- [dolphinscheduler-sdk-python](https://github.com/apache/dolphinscheduler-sdk-python): Python API to manage Dolphinscheduler workflow by code, aka PyDolphinscheduler.
Raw data
{
"_id": null,
"home_page": "https://github.com/zhongjiajie/stmdency",
"name": "stmdency",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "all",
"author": "Jay Chung",
"author_email": "zhongjiajie955@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/7c/63/5e0c0a0e8f1a3c31152fbaa5f0f251978f0345c2ec274541412629832235/stmdency-0.0.5.tar.gz",
"platform": null,
"description": "# Stmdency\n\n[![PyPi Version](https://img.shields.io/pypi/v/stmdency.svg?style=flat-square&logo=PyPi)](https://pypi.org/project/stmdency/)\n[![PyPi Python Versions](https://img.shields.io/pypi/pyversions/stmdency.svg?style=flat-square&logo=python)](https://pypi.org/project/stmdency/)\n[![PyPi License](https://img.shields.io/:license-Apache%202-blue.svg?style=flat-square)](https://raw.githubusercontent.com/zhongjiajie/stmdency/main/LICENSE)\n[![PyPi Status](https://img.shields.io/pypi/status/stmdency.svg?style=flat-square)](https://pypi.org/project/stmdency/)\n[![Downloads](https://pepy.tech/badge/stmdency/month)](https://pepy.tech/project/stmdency)\n[![Coverage Status](https://img.shields.io/codecov/c/github/zhongjiajie/stmdency/main.svg?style=flat-square)](https://codecov.io/github/zhongjiajie/stmdency?branch=main) <!-- markdown-link-check-disable-line -->\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg?style=flat-square)](https://github.com/psf/black)\n[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat-square&labelColor=ef8336)](https://pycqa.github.io/isort)\n[![CI](https://github.com/zhongjiajie/stmdency/actions/workflows/ci.yaml/badge.svg)](https://github.com/zhongjiajie/stmdency/actions/workflows/ci.yaml)\n[![Documentation Status](https://readthedocs.org/projects/stmdency/badge/?version=latest)](https://stmdency.readthedocs.io/en/latest/?badge=latest)\n\nstmdency, **sta**tement depen**dency** is a Python library for extracting dependencies between statements in a Python program.\n\n## Installation\n\n```shell\npython -m pip install --upgrade stmdency\n```\n\n## Usage\n\nLet's say we have a Python script named `test.py` with the following content:\n\n```python\na = 1\nb = 2\n\ndef bar():\n b = a + 3\n print(a, b)\n\ndef foo():\n bar(b)\n```\n\nWe want to extract function `foo` and all its dependencies. `stmdency` can do this for us:\n\n```python\nfrom stmdency.extractor import Extractor\n\nwith open(\"test.py\", \"r\") as f:\n source = f.read()\n extractor = Extractor(source)\n print(extractor.get_code(\"foo\"))\n```\n\nThe output will be:\n\n```python\na = 1\n\ndef bar():\n b = a + 3\n print(a, b)\n\nb = 2\n\ndef foo():\n bar(b)\n```\n\n## Documentation\n\nThe documentation host read the doc and is available at [https://stmdency.readthedocs.io](https://stmdency.readthedocs.io).\n\n## Who is using stmdency?\n\n- [dolphinscheduler-sdk-python](https://github.com/apache/dolphinscheduler-sdk-python): Python API to manage Dolphinscheduler workflow by code, aka PyDolphinscheduler.\n",
"bugtrack_url": null,
"license": "Apache License 2.0",
"summary": "A library extracting dependencies between statements in Python program.",
"version": "0.0.5",
"project_urls": {
"Changelog": "https://github.com/zhongjiajie/stmdency/releases",
"Documentation": "https://stmdency.readthedocs.io",
"Homepage": "https://github.com/zhongjiajie/stmdency",
"Issue Tracker": "https://github.com/zhongjiajie/stmdency/issues",
"Source": "https://github.com/zhongjiajie/stmdency"
},
"split_keywords": [
"all"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4fef9d44b0c5ded4b1252c24b641fd6f2219eb62e4e89a093b1a14fe906f13bc",
"md5": "20802025a32fd5986b13613927c02193",
"sha256": "11ed3d627aab9e8a84d6f574b2b5b7f8a9192ffd1a8bc30714717bcd8d8d0a58"
},
"downloads": -1,
"filename": "stmdency-0.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "20802025a32fd5986b13613927c02193",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 8445,
"upload_time": "2023-10-12T09:10:12",
"upload_time_iso_8601": "2023-10-12T09:10:12.740486Z",
"url": "https://files.pythonhosted.org/packages/4f/ef/9d44b0c5ded4b1252c24b641fd6f2219eb62e4e89a093b1a14fe906f13bc/stmdency-0.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7c635e0c0a0e8f1a3c31152fbaa5f0f251978f0345c2ec274541412629832235",
"md5": "f9a6f58b3786a35ce264815b705601d6",
"sha256": "3c938f391953ed4df6def0a136b6079c19cd5d0d0aa488d9f2d5efcfcd1b2e97"
},
"downloads": -1,
"filename": "stmdency-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "f9a6f58b3786a35ce264815b705601d6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 9030,
"upload_time": "2023-10-12T09:10:13",
"upload_time_iso_8601": "2023-10-12T09:10:13.854898Z",
"url": "https://files.pythonhosted.org/packages/7c/63/5e0c0a0e8f1a3c31152fbaa5f0f251978f0345c2ec274541412629832235/stmdency-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-12 09:10:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "zhongjiajie",
"github_project": "stmdency",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "stmdency"
}