Skip to main content

A Python module that builds a Dependency Matrix for your project.

Project description

Build Status Documentation Status Coverage Status

This Python module can build the dependency matrices of a project’s packages, based on from … import … commands in their modules. For now, its purpose is purely informational.

The module is composed of only one class: DependencyMatrix, which is initialized with a list of packages foundable is sys.path. This list of packages can be a string (one package), a list (several) or an ordered dictionary, used to define groups of packages with a legend. We use an ordered dictionary because it is important to keep the same order as the one given by the user. On the other hand it is not always handy to pass an OrderedDict instance, so in the future we could maybe pass a list of dict.

Usage

from dependenpy.utils import MatrixBuilder

myapps = (
    module1,
    module2,
    ...,
    moduleN
)

# Create an empty instance
dm = MatrixBuilder(myapps)

# Init its data with build methods
dm.build()

# You can also use separately dm.build_modules(),
# dm.build_imports() and dm.build_matrices().
# You can even chain them: dm.build_modules().build_imports().build_matrices().
# The order is important, since matrices need imports, and imports need modules.
# The build() method is just a shortcut of the above chained command.

# Print max depth of submodules and the big dictionary of imports
print dm.max_depth
print dm.imports

Here is an example of colorized CSV output:

CSV array

This module was originally design to work in a Django project. The Django package django-archan has been built on it to display the matrices with D3JS.

Documentation

On ReadTheDocs

License

Copyright (c) 2015 Timothée Mazzucotelli

This Source Code is subject to the terms of the Mozilla Public License, v. 2.0. See the LICENSE.txt file for more details.

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

dependenpy-1.1.1.tar.gz (17.0 kB view hashes)

Uploaded Source

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