Git-aware checker for globally unique Python function names + reuse suggestions for AI agents
Project description
uniqfunc
A git-aware checker for AI-generated Python code that enforces repo-wide unique function names (blocking) and emits reuse candidates for agent review (non-blocking).
Recommended agent loop (Codex)
- Generate or modify code.
- Run
uvx uniqfunc --format json. - If exit code
1, fix naming conflicts until clean. - If
reuse_suggestionsare present, consider reusing or refactoring existing functions.
VS Code integration
Text output is VS Code-clickable because every diagnostic line begins with path:line:col (no leading spaces).
Usage
uvx uniqfunc
Output examples
Text (duplicate):
path/to/file.py:10:1 UQF100 duplicate function name 'foo' (also in other.py:42:1)
Text (reuse suggestions):
=== UNIQFUNC LLM REUSE SUGGESTIONS ===
src/timeutils.py:12:1 UQF200 reuse_candidate target=epoch_to_aware_datetime candidates=1
src/timeutils.py:5:1 UQF201 candidate_for=epoch_to_aware_datetime name=epoch_to_datetime score=0.83 signals=name_token_jaccard:0.66 signature:0.75 ast:0.90
=== END UNIQFUNC LLM REUSE SUGGESTIONS ===
JSON:
{
"version": "0.1.1",
"repo_root": "/abs/path",
"naming_conflicts": [
{
"code": "UQF100",
"name": "foo",
"occurrence": {"path": "a.py", "line": 10, "col": 1},
"first_seen": {"path": "b.py", "line": 42, "col": 1}
}
],
"reuse_suggestions": [
{
"target": {"path": "timeutils.py", "line": 12, "col": 1, "name": "epoch_to_aware_datetime"},
"candidates": [
{
"path": "timeutils.py",
"line": 5,
"col": 1,
"name": "epoch_to_datetime",
"score": 0.83,
"signals": {
"name_token_jaccard": 0.66,
"signature_score": 0.75,
"ast_score": 0.90
}
}
]
}
],
"errors": []
}
Notes
- Requires a git repo and uses
git ls-filesfor file selection. - No config by design.
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
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 uniqfunc-0.1.1.tar.gz.
File metadata
- Download URL: uniqfunc-0.1.1.tar.gz
- Upload date:
- Size: 567.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
320a26a2ef40a1c0f3c4d6474beb5504f5c013a7fc06f88daef7f67cd0c78cc9
|
|
| MD5 |
95f0c4eff7d4e22124a2795a9294bed0
|
|
| BLAKE2b-256 |
09db3e147c5c2e7f4407eb7cf8f1ddc4c3253365becbbfe1414adf3fc44ed5a0
|
File details
Details for the file uniqfunc-0.1.1-py3-none-any.whl.
File metadata
- Download URL: uniqfunc-0.1.1-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
856c41203eb78baa59deb557f9471d612512c3c1e44dffcaf4dd98c7097d8160
|
|
| MD5 |
e5a1eaabc9d4797e9e723225a002d2c2
|
|
| BLAKE2b-256 |
b008f165996bf77be48d50372439252d77f60ee57b83f2577f7e5ccf4834f922
|