Skip to content

Extract an array of dependencies from source files written some popular languages.

License

Notifications You must be signed in to change notification settings

dacresearchgroup/c137-morphemic-dependency-extractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Extract an array of dependencies from source files written some popular languages.

Topics

Resources

License

Stars

Watchers

Forks

Languages