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(...), ...
"datetime.datetime.now" # forbid datetime.now()
]
With datetime.now for example you usually want to ignore one call to it for implementing a project-wide default function. You can use # pyaphid: ignore to ignore a line:
from dateutil.tz import tzlocal
from datetime import datetime
def get_now():
# allowed
return datetime.now(tzlocal()) # pyaphid: ignore
datetime.now() # forbidden
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.3.1
hooks:
- id: pyaphid
Limitations
# Pyaphid cannot work with star imports
from os.path import *
dirname(".") # undetected
# Pyaphid doesn't track assignments
my_print = print
my_print("Hello world") # undetected
Metadata
Release files for pyaphid 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyaphid-0.3.1.tar.gz | 7.4 kB | Without provenance | Details for pyaphid-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyaphid-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for pyaphid-0.3.1-py3-none-any.whl |
Total release size: 15.4 kB
Release files / pyaphid-0.3.1.tar.gz
| Download URL | pyaphid-0.3.1.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cdc951d45294e71ca35d581a314f68e3164423ad3501247bd54f34c8716b2f08
|
|
BLAKE2b-256 checksum How to use checksums |
d4fae891fdd2633536e32011a531abf34646a8c9b223ee84dc9d4e4c95652080
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.2
|
Release files / pyaphid-0.3.1-py3-none-any.whl
| Download URL | pyaphid-0.3.1-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b58f2f465ed1d97db0c37a7f295ffe028d7f78b6be80e24f757270cec70ade94
|
|
BLAKE2b-256 checksum How to use checksums |
561329ab60afd146ccc518b4b8ee43d37c1c3a328c30b7fec4e3be29af008814
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.2
|
Security for pyaphid 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.