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
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 invectio-0.0.5.tar.gz
.
File metadata
- Download URL: invectio-0.0.5.tar.gz
- Upload date:
- Size: 5.4 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddef94947d0082f4e7904584863e571b82a1892efb43b3b5961a21215b282fed |
|
MD5 | c22b1acd554bb848670397021c03dba2 |
|
BLAKE2b-256 | 378d9900e447427f721bf68e28016a76a9dd4d5681055f85b12ce985a052282e |
File details
Details for the file invectio-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: invectio-0.0.5-py3-none-any.whl
- Upload date:
- Size: 8.4 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 92062571cc85c42fd99d52ccd19c9502bfd1ff45f21d4e71b496786346235e66 |
|
MD5 | 96cd1f98a7cd69d54fa8ce78a0ecae2e |
|
BLAKE2b-256 | 4fa63357c4231154a9231fdfa1e99b44ac3080c309beb9d984146d59359c8e18 |