Find usage statistics (imports, function calls, attribute access) for Python code-bases

Overview

Python Library stats

This is a small library that allows you to query some useful statistics for Python code-bases. We currently report library imports, function calls and attributes.

Usage

In order to find all uses (imports / function calls / attribute queries) from library over codebase , run the following command:

python main.py --local_dir 
   
     --library_name 
    

    
   

Example

Looking for all torchvision occurrences on the DETR codebase yields:

===========================================================================
                                  Imports
===========================================================================
                                                                    | Count
---------------------------------------------------------------------------
    torchvision                                                     : 4
    torchvision.ops._new_empty_tensor                               : 1
    torchvision.ops.misc._output_size                               : 1
    torchvision.ops.boxes.box_area                                  : 1
    torchvision.transforms                                          : 1
    torchvision.transforms.functional                               : 1
    torchvision.models._utils.IntermediateLayerGetter               : 1
===========================================================================
                                   Calls
===========================================================================
                                                                    | Count
---------------------------------------------------------------------------
    torchvision.__version__.split                                   : 2
    torchvision.ops.boxes.box_area                                  : 2
    torchvision.transforms.RandomCrop.get_params                    : 2
    torchvision._is_tracing                                         : 1
    torchvision.ops.misc._output_size                               : 1
    torchvision.ops._new_empty_tensor                               : 1
    torchvision.ops.misc.interpolate                                : 1
    torchvision.transforms.functional.crop                          : 1
    torchvision.transforms.functional.hflip                         : 1
    torchvision.transforms.functional.resize                        : 1
    torchvision.transforms.functional.pad                           : 1
    torchvision.transforms.functional.to_tensor                     : 1
    torchvision.transforms.RandomErasing                            : 1
    torchvision.transforms.functional.normalize                     : 1
    torchvision.models._utils.IntermediateLayerGetter               : 1
    torchvision.models.{?}                                          : 1
===========================================================================
                                   Attrs
===========================================================================
                                                                    | Count
---------------------------------------------------------------------------
    torchvision.__version__.split                                   : 2
    torchvision.ops.boxes.box_area                                  : 2
    torchvision.datasets.CocoDetection                              : 2
    torchvision.transforms.RandomCrop.get_params                    : 2
    torchvision._is_tracing                                         : 1
    torchvision.ops.misc._output_size                               : 1
    torchvision.ops._new_empty_tensor                               : 1
    torchvision.ops.misc.interpolate                                : 1
    torchvision.transforms.functional.crop                          : 1
    torchvision.transforms.functional.hflip                         : 1
    torchvision.transforms.functional.resize                        : 1
    torchvision.transforms.functional.pad                           : 1
    torchvision.transforms.functional.to_tensor                     : 1
    torchvision.transforms.RandomErasing                            : 1
    torchvision.transforms.functional.normalize                     : 1
    torchvision.models._utils.IntermediateLayerGetter               : 1
    torchvision.models                                              : 1
Owner
Francisco Massa
Francisco Massa
Collection of library stubs for Python, with static types

typeshed About Typeshed contains external type annotations for the Python standard library and Python builtins, as well as third party packages as con

Python 3.3k Jan 02, 2023
Typing-toolbox for Python 3 _and_ 2.7 w.r.t. PEP 484.

Welcome to the pytypes project pytypes is a typing toolbox w.r.t. PEP 484 (PEP 526 on the road map, later also 544 if it gets accepted). Its main feat

Stefan Richthofer 188 Dec 29, 2022
Unbearably fast O(1) runtime type-checking in pure Python.

Look for the bare necessities, the simple bare necessities. Forget about your worries and your strife. — The Jungle Book.

1.4k Dec 29, 2022
A formatter for Python files

YAPF Introduction Most of the current formatters for Python --- e.g., autopep8, and pep8ify --- are made to remove lint errors from code. This has som

Google 13k Dec 31, 2022
A bytecode vm written in python.

CHex A bytecode vm written in python. hex command meaning note: the first two hex values of a CHex program are the magic number 0x01 (offset in memory

1 Aug 26, 2022
Code audit tool for python.

Pylama Code audit tool for Python and JavaScript. Pylama wraps these tools: pycodestyle (formerly pep8) © 2012-2013, Florent Xicluna; pydocstyle (form

Kirill Klenov 966 Dec 29, 2022
This is a Python program to get the source lines of code (SLOC) count for a given GitHub repository.

This is a Python program to get the source lines of code (SLOC) count for a given GitHub repository.

Nipuna Weerasekara 2 Mar 10, 2022
Alarmer is a tool focus on error reporting for your application.

alarmer Alarmer is a tool focus on error reporting for your application. Installation pip install alarmer Usage It's simple to integrate alarmer in yo

long2ice 20 Jul 03, 2022
Pymwp is a tool for automatically performing static analysis on programs written in C

pymwp: MWP analysis in Python pymwp is a tool for automatically performing static analysis on programs written in C, inspired by "A Flow Calculus of m

Static Analyses of Program Flows: Types and Certificate for Complexity 2 Dec 02, 2022
A simple stopwatch for measuring code performance with static typing.

A simple stopwatch for measuring code performance. This is a fork from python-stopwatch, which adds static typing and a few other things.

Rafael 2 Feb 18, 2022
A static analysis tool for Python

pyanalyze Pyanalyze is a tool for programmatically detecting common mistakes in Python code, such as references to undefined variables and some catego

Quora 212 Jan 07, 2023
Data parsing and validation using Python type hints

pydantic Data validation and settings management using Python type hinting. Fast and extensible, pydantic plays nicely with your linters/IDE/brain. De

Samuel Colvin 12.1k Jan 05, 2023
A Python utility / library to sort imports.

Read Latest Documentation - Browse GitHub Code Repository isort your imports, so you don't have to. isort is a Python utility / library to sort import

Python Code Quality Authority 5.5k Jan 06, 2023
An app to show the total number of lines of code written by an user.

Lines of code Have you ever wondered how many lines of code you wrote in github? This tool will calculate it for you! To calculate the total number of

B.Jothin kumar 10 Jan 26, 2022
Static type checker for Python

Static type checker for Python Speed Pyright is a fast type checker meant for large Python source bases. It can run in a “watch” mode and performs fas

Microsoft 9.4k Jan 07, 2023
A very minimalistic python module that lets you track the time your code snippets take to run.

Clock Keeper A very minimalistic python module that lets you track the time your code snippets take to run. This package is available on PyPI! Run the

Rajdeep Biswas 1 Jan 19, 2022
ticktock is a minimalist library to profile Python code

ticktock is a minimalist library to profile Python code: it periodically displays timing of running code.

Victor Benichoux 30 Sep 28, 2022
Run-time type checker for Python

This library provides run-time type checking for functions defined with PEP 484 argument (and return) type annotations. Four principal ways to do type

Alex Grönholm 1.1k Dec 19, 2022
An interpreter for the X1 bytecode.

X1 Bytecode Interpreter The X1 Bytecode is bytecode designed for simplicity in programming design and compilation. Bytecode Instructions push

Thanasis Tzimas 1 Jan 15, 2022
Find dead Python code

Vulture - Find dead code Vulture finds unused code in Python programs. This is useful for cleaning up and finding errors in large code bases. If you r

Jendrik Seipp 2.4k Jan 03, 2023