Skip to main content

Statically analyze sources and extract information about called and exported library functions in Python applications

Project description

A simple tool to gather symbols provided or library calls and attribute usage based on static analysis of sources of Python applications.

See [the linked article describing this tool](


Invectio can be installed from PyPI using:

$ pip3 install invectio
$ invectio --help


You can use this library as a CLI tool or as a Python module:

invectio whatprovides project-dir/   # To scan all Python files recursively for symbols provided.
invectio whatprovides         # To perform symbols gathering on file.

invectio whatuses project-dir/       # To scan all Python files recursively for symbols used from libraries.
invectio whatuses             # To perform gather symbols used from libraries on file.
from invectio import gather_library_calls
from invectio import gather_symbols_provided

result: dict = gather_library_usage("project-dir")
result: dict = gather_library_usage("")

result: dict = gather_symbols_provided("project-dir")
result: dict = gather_symbols_provided("")


As Python is a dynamic programming language, it’s not possible to obtain all library functions/attributes usage simply by performing static analysis of sources. One can still perfom “crazy” things like:

import tensorflow

getattr(tensorflow, "const" + "ant")("Hello, Invectio")

This library does its best to detect all function/attributes being used inside Python sources, but usage like shown above cannot be detected simply by static analysis of source code.


To create a dev environment, clone the invectio repo and install all the dependencies:

git clone && cd invectio
pipenv install --dev

To perform checks against unit tests present in the tests/ directory, issue the following command from the root of the git repo:

pipenv run python3 test

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

invectio-0.2.2.tar.gz (20.8 kB view hashes)

Uploaded source

Built Distribution

invectio-0.2.2-py3-none-any.whl (21.3 kB view hashes)

Uploaded py3

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