Identify unwanted function calls in your code
Project description
Pyaphid
Description
Pyaphid is a static analysis tool for detecting unwanted function calls in Python code.
Installation and usage
Installation: pip install pyaphid
Usage: python -m pyaphid <files and/or directories to analyze>
or pyaphid <files and/or directories to analyze>
Configuration
Forbidden function calls can be configured via the pyproject.toml
:
[tool.pyaphid]
forbidden = [
"print", # forbid print(...)
"pdb.run", # forbid pdb.run(...)
"werkzeug.debug.*" # forbid werkzeug.debug.DebuggedApplication(...), werkzeug.debug.get_machine_id(...), ...
]
CLI Options
- -n / --names:
Look-up all func calls and print their identifier
As a pre-commit hook
- repo: https://github.com/jvllmr/pyaphid
rev: v0.1.3
hooks:
- id: pyaphid
Limitations
# Pyaphid cannot work with star imports
from os.path import *
dirname(".") # undetected
# Pyaphid ignores relative imports
from . import something
something() # undetected
# Pyaphid doesn't track assignments
my_print = print
my_print("Hello world") # undetected
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
pyaphid-0.1.3.tar.gz
(6.3 kB
view details)
Built Distribution
File details
Details for the file pyaphid-0.1.3.tar.gz
.
File metadata
- Download URL: pyaphid-0.1.3.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7f97ae5fcaf9c6530275f02606f9b179d6c2980c9870fd292d66a68f3c86f5c |
|
MD5 | 8325c3833700c153e791c9b8a3b2ca99 |
|
BLAKE2b-256 | 424a95634713db36bcbe0a1b0111e5c2b4e37e4ae0d268c0b7f531037d5b595b |
File details
Details for the file pyaphid-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: pyaphid-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71c0c41587360ff0e6c4dac52d4fd6b2bfc059e2a80b613c16a8ed491e5a67f7 |
|
MD5 | f5c5bcc54387a3be731daff56381bc1e |
|
BLAKE2b-256 | c025c38f0efdbdc0a4492984020996706d105450eb229adce9456cc165ee1af5 |