Metadata-Version: 2.1
Name: module-graph
Version: 0.0.1
Summary: Show python modules dependency graph and static memory usage.
Home-page: https://github.com/guyskk/module_graph
Author: guyskk
Author-email: guyskk@qq.com
License: UNKNOWN
Description: # Module Graph
        
        Show python modules dependency graph and static memory usage.
        
        ## Install
        
        First you need [graphviz](https://www.graphviz.org/) installed in your system.
        
        - Mac:
        
            ```
            brew install graphviz
            ```
        
        - Ubuntu:
        
            ```
            sudo apt-get update
            sudo apt-get install graphviz libgraphviz-dev pkg-config
            ```
        
        Then:
        
        ```
        pip install 'module-graph[all]'
        ```
        
        ## Usage
        
        ### Analysis current installed modules
        
        Travel all modules and generate graph data:
        
        ```
        python -m module_graph.run_traveler
        ```
        
        Command reference:
        
        ```
        usage: run_traveler.py [-h] [--modules MODULES] [--ignore IGNORE]
        
        Module Graph Traveler
        
        optional arguments:
          -h, --help         show this help message and exit
          --modules MODULES  top level modules to check, default all modules
          --ignore IGNORE    ignore modules (shell patterns)
        ```
        
        ### Analysis modules used by application
        
        > **Warning**: the hooker will do crazy patch to `sys` module, your application may be slower or crash!
        
        Setup hooker as early as possible in application.
        
        ```python
        import module_graph
        
        if __name__ == "__main__":
            memory_hooker = module_graph.setup_hooker(
                save_to='data/module_graph.json', verbose=True)
        ```
        
        Run your aplication for a while, then stop it.
        The hooker will generate data for all modules used by application.
        
        ### Render graph
        
        Use `module-graph` command to render graph, for example:
        
        ```
        module-graph --input-filepath data/module_graph.json
        ```
        
        Command reference:
        
        ```
        usage: module-graph [-h] [--modules-filepath MODULES_FILEPATH]
                            [--input-filepath INPUT_FILEPATH]
                            [--output-filepath OUTPUT_FILEPATH]
                            [--threshold THRESHOLD]
        
        Module Graph Render
        
        optional arguments:
          -h, --help            show this help message and exit
          --modules-filepath MODULES_FILEPATH
                                modules to render, default all modules
          --input-filepath INPUT_FILEPATH
                                the module graph data generated by hooker (json file)
          --output-filepath OUTPUT_FILEPATH
                                render output PDF filepath
          --threshold THRESHOLD
                                donot show module which memory usage < threshold (MB)
        ```
        
        ## How it work
        
        It patch `sys.meta_path`, `sys.modules` and all module loaders,
        then record memory before and after module import.
        
        ## License
        
        This package is distributed under the MIT license.
        
Keywords: module dependency graph memory
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Requires-Python: >=3.4, <4
Description-Content-Type: text/markdown
Provides-Extra: all
