Detect duplicate function names in Python source files using AST parsing
Project description
check-duplicate-functions
Detect duplicate function names in Python files using AST parsing.
Features
- Detects duplicate function names (module-level and in classes)
- AST-based; handles async functions and type annotations
- Excludes special methods (
__init__,__str__, etc.) - No external dependencies
Requirements
- Python 3.8+
- Standard library only
Installation
pip install check-duplicate-functions
Usage
check-duplicate-functions <python_file_path>
Examples
check-duplicate-functions my_script.py
check-duplicate-functions src/utils.py
Output
- No duplicates: Exits with code 0 (no output)
- Duplicates found: Prints each duplicate name and line numbers, e.g.
[DUPLICATE] 'my_function' appears on lines: 10, 25, 42 - Errors: Prints message and exits with code 1
Exit codes
0— Success1— Error (bad args, file not found, syntax error, etc.)
Author
Pandiyaraj Karuppasamy
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 check_duplicate_functions-1.0.1.tar.gz.
File metadata
- Download URL: check_duplicate_functions-1.0.1.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49089a0e9e356b52d30e744c653ac82a77395889c5762ab5f94dc71820b86f3d
|
|
| MD5 |
862df58c343ecab03a26aa680f8314d3
|
|
| BLAKE2b-256 |
b33f3128ac223841c685bd30f3c7259213c356d0fdcb3a318f763912cb8e3e72
|
File details
Details for the file check_duplicate_functions-1.0.1-py3-none-any.whl.
File metadata
- Download URL: check_duplicate_functions-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d8ae2a6c190d18d642e7ea1ef7aaef2cb7aeaaa0e0721f42f41941a8f79bcdbd
|
|
| MD5 |
0432c405e9b01237705e5d2a9c21cc68
|
|
| BLAKE2b-256 |
936e21be378cb078bfdaff7727d93cc6a70af7072b7ca8d345e8ae0233763205
|