Skip to content

Latest commit

 

History

History
66 lines (42 loc) · 1.75 KB

File metadata and controls

66 lines (42 loc) · 1.75 KB

Dependency Extractor

A Python library which extracts library dependencies from source files written in most mainstream programming languages.

** ⚠️ Warning: This library is not meant for production use, as extended testing has not been carried out yet.**

Getting started

Follow the steps below to get started with dextractor.

Installation

This package can be installed easily via pip. Run the commands below:

# Clone or download the .zip from the Releases tab.
git clone https://www.github.com/alexandrosraikos/dependency-extractor

# Navigate to the folder.
cd dependency-extractor

# Install locally
pip install .

Usage

It is meant to be imported and called via a single module, which returns a Dictionary of dependencies given a single file or a directory.

from dextractor import analyse

# Use all default parameters.
result = analyse("path/to/file/or/directory")

# Define a different maximum file size (in bytes).
result = analyse("path/to/file/or/directory", max_file_size=2000000) # <- 2MB

# Ignore local and relative dependencies.
result = analyse("path/to/file/or/directory", strict=True)

# Enable verbose output. NOTE: Do not enable on parallel analyses.
result = analyse("path/to/file/or/directory", verbose=True)

#
# Then you can access the following keys:
# --
dependencies = result["dependencies"]
configurations = result["configurations"]

Unit testing

Please consult the README in the tests folder.

Supported languages

All languages which are supported are still in alpha. Regular expressions which detect imports in source files must be polished and updated with the nuances of each programming language. Currently the supported languages are:

  1. C/C++
  2. Go
  3. Python (duh!)
  4. Java
  5. JavaScript