Semantic checker for AI-generated Python code.
Project description
aicode-verify
aicode-verify is a semantic checker for AI-generated Python. It parses code without executing it, verifies imported symbols against the current environment, checks direct-call signatures, and scans for common security hazards.
It is intentionally not a style linter. It answers questions like:
- Is this module installed here?
- Does
from package import nameactually exist? - Does this callable accept the keyword arguments the code uses?
- Did the generated code introduce obvious injection or secret-handling risks?
Install
pip install aicode-verify
For local development:
pip install -e ".[dev]"
CLI
aicode-verify path/to/file.py
aicode-verify src/**/*.py --fail-on high
aicode-verify script.py --format json
--fail-on accepts error, high, or medium. The default is error.
Python API
from aicode_verify import format_report, verify
source = "import math\nmath.sqrt(value=4)\n"
findings = verify(source)
print(format_report(findings, source))
Pre-commit
Add this to .pre-commit-config.yaml:
repos:
- repo: https://github.com/Github-Rajesh/AiCode-Verify
rev: v0.1.0
hooks:
- id: aicode-verify
What it checks today
- Missing top-level imports.
- Missing symbols in
from ... import .... - Direct imported calls such as
pd.read_csv(...),Path(...), andjson.loads(...). - Unknown keyword arguments and simple missing required argument cases.
- Security patterns including
eval,exec,compile,shell=True,os.system, unsafe pickle usage, weak hashes, hardcoded secrets, and SQL f-strings.
Limitations
The checker does not perform full type inference. Chained calls like df.groupby("x").agg(...) are only checked where the root object can be resolved statically. That keeps the first release fast and practical while leaving room for future stub-based inference.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aicode_verify-0.1.0.tar.gz.
File metadata
- Download URL: aicode_verify-0.1.0.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0086ef841c2a5d85abd50bcf519ad5101ecb0a404b64830b43a70657298d8d4f
|
|
| MD5 |
39ee016f1edcac941ddbdc92ad92d82f
|
|
| BLAKE2b-256 |
db3ed428d435ee3dccebb87042f845f98e6e30fc55165979aece6cf19d964825
|
File details
Details for the file aicode_verify-0.1.0-py3-none-any.whl.
File metadata
- Download URL: aicode_verify-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0de57e40013afdf9a7892413797cfc4fd68d818bc18640d97885895e5c88835c
|
|
| MD5 |
133955a42d750200014ab6c94ec2a8b2
|
|
| BLAKE2b-256 |
5e260e1d3c717e7b7f60ad4489509542ffeaed4940ae7c1bc08e65d5359878b1
|