Skip to main content

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

Project description

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

Installation

Invectio can be installed from PyPI using:

$ pip3 install invectio
$ invectio --help

Usage

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

invectio project-dir/   # To scan all Python files recursively.
invectio app.py         # To perform usage gathering just on app.py file.
from invectio import gather_library_calls

# To scan all Python files recursively.
result: dict = gather_library_usage("project-dir")

# To perform usage gathering just on app.py file.
result: dict = gather_library_usage("app.py")

Limitations

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.

Development

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

git clone https:://github.com/thoth-station/invectio && 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 setup.py 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.0.6.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

invectio-0.0.6-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file invectio-0.0.6.tar.gz.

File metadata

  • Download URL: invectio-0.0.6.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/36.5.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.3

File hashes

Hashes for invectio-0.0.6.tar.gz
Algorithm Hash digest
SHA256 c0aec0386cf1d0a9af4f76ad6c0a451106db6343aac4473e9640ff23e8f805dc
MD5 56a48bef2e5601525f30e320b40e957c
BLAKE2b-256 fbbf0e51e97f904848799fbb432cde90a30554737b311f7ac13dfeb2e650dbf3

See more details on using hashes here.

File details

Details for the file invectio-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: invectio-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/36.5.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.6.3

File hashes

Hashes for invectio-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 09285cc9ec88c7bc92212ae2dc5bf309805126324846df3c244c21d5505c426e
MD5 b62b0f1bf36bec01d6896de9ffe4ccc8
BLAKE2b-256 86d28c7cc5d8b68a6334c9e95099caef78c894cd3857353cc6089cb664c5eebb

See more details on using hashes here.

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