Skip to main content

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)

  1. Generate or modify code.
  2. Run uvx uniqfunc --format json.
  3. If exit code 1, fix naming conflicts until clean.
  4. If reuse_suggestions are 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

Defaults ignore main and cli. Add more exclude patterns (repeatable regex):

uvx uniqfunc --exclude-name '^main$' --exclude-name '^cli$'

Output examples

Text (duplicate):

path/to/file.py:10:1 UQF100 duplicate function name 'foo' (also in other.py:42:1) signature=def foo(): also_signature=def foo():

Text (reuse suggestions):

=== UNIQFUNC LLM REUSE SUGGESTIONS ===
src/timeutils.py:12:1 UQF200 reuse_candidate target=epoch_to_aware_datetime candidates=1 signature=def epoch_to_aware_datetime(epoch_seconds) -> datetime:
src/timeutils.py:5:1 UQF201 candidate_for=epoch_to_aware_datetime target_loc=src/timeutils.py:12:1 name=epoch_to_datetime score=0.83 signals=name_token_jaccard:0.66 signature:0.75 ast:0.90 signature=def epoch_to_datetime(epoch) -> datetime:
=== END UNIQFUNC LLM REUSE SUGGESTIONS ===

JSON:

{
  "version": "0.1.3",
  "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-files for file selection.
  • No config by design.

Metadata

Release files for uniqfunc 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for uniqfunc 0.1.3
File Size Uploaded
uniqfunc-0.1.3.tar.gz 571.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for uniqfunc 0.1.3
File Interpreter ABI Platform
uniqfunc-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 594.1 kB

Release files / uniqfunc-0.1.3.tar.gz

Download URL uniqfunc-0.1.3.tar.gz
Size 571.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0007be4f86bb1caabd7d0b4303b63b8153e3357103e38a62a14c55d636794914
BLAKE2b-256 checksum
How to use checksums
e8af07ef090344582786221b14b59ab3042481c36ce4cd57fe723d97e370fcd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / uniqfunc-0.1.3-py3-none-any.whl

Download URL uniqfunc-0.1.3-py3-none-any.whl
Size 22.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd3a0bda5342f33e64fd492ed282321dd5d15fdc920da7895d0a7bd4e7c9d026
BLAKE2b-256 checksum
How to use checksums
784707b4af96f49c9242c4e81bc2207070e2cc162f50f242768ffd254fd16b57
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page