A Python module that builds a Dependency Matrix for your project.
Project description
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
# Output matrix of depth 1 in CSV
dm.get_matrix(1).to_csv()
# Output matrix of maximum depth in JSON
dm.get_matrix(0).to_json()
Here is an example of colorized CSV output:
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.
Thanks
Thanks to dmishin for the TSP solver, needed to compute the similarity order.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file dependenpy-2.0.0.tar.gz
.
File metadata
- Download URL: dependenpy-2.0.0.tar.gz
- Upload date:
- Size: 20.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | baa7f8c6c2c2b7e114bc90e91526a7d9930c6ca5b5264205e8fa3053daa5d008 |
|
MD5 | 6df764303c8f8c379b60b213ddd2cefe |
|
BLAKE2b-256 | 2918ca87e0718b83a6dd2ce94c275e3ec0f5d4c2f8058f2582a3d01e386a8faf |
File details
Details for the file dependenpy-2.0.0-py27.py33.py34-none-any.whl
.
File metadata
- Download URL: dependenpy-2.0.0-py27.py33.py34-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 2.7, Python 3.3, Python 3.4
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d6e36dd767fd4a89cabe73565b5d5e8e76e04ba4e0ed133d645dff95ba6ecd0 |
|
MD5 | 3b7d4c4ad1904d71ade5411b4d089038 |
|
BLAKE2b-256 | 6a662409ccb04194107579e7c1574e477143e05b9a4d702f638ede34b86c327b |