DG-Parser
A Python package for parsing and analyzing code dependency graphs.
Features
- Parse Python code to generate dependency graphs
- Analyze module dependencies and relationships
- Command-line interface for quick analysis
- Export dependency graphs (i.e. Pickle)
Getting Started
Prerequisites
- Python 3.8 or higher
- pip package manager
Installation
- From PyPI (not yet published):
pip install dg-parser
- From source:
git clone https://github.com/nmd2k/DG-parser.git
cd DG-parser
pip install -e .
Basic Usage
1. Command Line Interface
The package provides a convenient CLI for quick analysis:
dp-parser analyze tests/test_data/sample_project
>>> Analyzing project: tests/test_data/sample_project
Function Signature: validate_input
Dependencies:
Calls: from utils import validate_input, transform_data
Parameters: ['data']
----------------------------------------------------------------------------------------------------
Function Signature: transform_data
Dependencies:
Calls: from utils import validate_input, transform_data
Parameters: ['data']
----------------------------------------------------------------------------------------------------
Function Signature: ValueError
Dependencies:
Calls: ValueError
Parameters: []
----------------------------------------------------------------------------------------------------
Function Signature: process_data
Dependencies:
transform_data
ValueError
validate_input
Calls: def process_data(data):
Parameters: ['data']
----------------------------------------------------------------------------------------------------
Dependency graph saved to: output/sample_project_graph.pkl
2. Python API
from dp_graph import PythonParser
# Create a dependency graph instance
parser = PythonParser()
# Parse a Python project
graph = parser.parse("/path/to/project")
# Get all dependencies
for node in graph.nodes.values():
print("\tFunction Signature:", node.signature)
print("\tDependencies:")
for dep in node.dependencies:
print(f"\t\t{dep.signature}")
print("\tCalls:", node.code.split("\n")[0])
print("\tParameters:", node.parameters)
print("-" * 100)
# Export the graph
# Comming soon
License
MIT License
Metadata
Release files for dp-parser 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dp_parser-0.1.0.tar.gz | 9.8 kB | Without provenance | Details for dp_parser-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dp_parser-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for dp_parser-0.1.0-py3-none-any.whl |
Total release size: 19.3 kB
Release files / dp_parser-0.1.0.tar.gz
| Download URL | dp_parser-0.1.0.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b4490c6d0ba581089496140076ffac018ad8230ef9321920d0a7a755b4ad39c3
|
|
BLAKE2b-256 checksum How to use checksums |
9f7e2a7cb5712b4e00c6114fc309bcdea93baf1e001a9c4bca768b1b39b94f91
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|
Release files / dp_parser-0.1.0-py3-none-any.whl
| Download URL | dp_parser-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce2db643a9805526f8922cec0fa057dc0d5f8a7d20df7cf95a4e7e0bb018ed18
|
|
BLAKE2b-256 checksum How to use checksums |
2102dfc2e30aadf8176bcf88e33bac8394f2b531cfed8b1c45f8797e87420f85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|
Security for dp-parser 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.