Static Python code analyzer with a local Tkinter GUI: detects unused imports, dead definitions, and similar code blocks using AST analysis.
English | Deutsch
Tip
For LLM agents, automated tools, and context-aware indexing, a canonical RAG index is provided at llms.txt.
| Feature | Description |
|---|---|
| AST Analysis | Precise analysis powered by the Python Abstract Syntax Tree (AST) |
| Import Tracking | Detects used, unused, and duplicate imports |
| Method Catalog | Lists all functions, methods, and classes in a structured layout |
| Duplicate Detection | Finds similar code blocks with a configurable similarity threshold |
| Framework Awareness | Recognizes implicit usage in Tkinter, requests, asyncio, and other frameworks |
| Callback Detection | Correctly identifies callback functions as actively used |
| Multi-File Scan | Recursively analyzes entire Python projects |
| Desktop GUI | Clean Tkinter-based user interface; no terminal required for basic usage |
| Feature | MethodenAnalyser | pylint | flake8 | vulture | radon |
|---|---|---|---|---|---|
| Unused Imports | yes | yes | partial | yes | no |
| Unused Definitions | yes | partial | no | yes | no |
| Code Similarity | yes | no | no | no | no |
| Framework Awareness | yes | partial | no | no | no |
| GUI Interface | yes | no | no | no | no |
| Callback Recognition | yes | no | no | partial | no |
| Zero Installation (Portable) | yes | no | no | no | no |
The desktop user interface displaying file-based analysis results and structural metrics.
MethodenAnalyser requires no external runtime dependencies. Only a Python 3.10+ environment is needed.
git clone https://github.com/dev-bricks/MethodenAnalyser.git
cd MethodenAnalyser
python MethodenAnalyser3.pyOn Windows, you can also start the tool by double-clicking START.bat.
Runtime uses only the Python standard library. For tests and EXE builds install the bounded development toolchain from requirements-dev.txt; the commands and build boundary are documented in BUILD.md.
- Launch the tool:
python MethodenAnalyser3.pyor double-clickSTART.bat. - Click Analyze File (Datei analysieren) and select a
.pyfile. - Review the findings in the output text area.
- Click Analyze Project (Projekt analysieren) and select a folder.
- The tool recursively scans all
.pyfiles inside the directory. - An aggregated project report is compiled and displayed.
MethodenAnalyser can also run completely headless for terminal integration or CI pipelines:
# Analyze a single file
python MethodenAnalyser3.py --file path/to/file.py
# Analyze an entire project folder
python MethodenAnalyser3.py --project path/to/project
# Analyze a file and export findings to JSON
python MethodenAnalyser3.py --file path/to/file.py --json-output
# Analyze via stdin and pipe output to a JSON file
type path\to\file.py | python MethodenAnalyser3.py --stdin --json-output snippet.jsonThe --json-output flag exports a machine-readable report named methodenanalyser-report-v1.json (or a custom name if specified). Its structure is documented in EXPORTFORMAT.md.
The local POST /api/analyze helper accepts source_kind snippet, file,
and zip. A project POST is intentionally rejected; project reports are
generated by the desktop/CLI path and may be imported separately in the local
web UI. See EXPORTFORMAT.md and WEBAPP.md for
the source-kind matrix.
For browser-based snippets, file uploads, or small ZIP archives, you can launch the optional local helper. It is not a cloud service or a mobile product:
python webapp/server.pyOr double-click START_WEBAPP.bat on Windows. The server runs at http://127.0.0.1:8765/ by default and utilizes the same AST analysis engine.
- PWA Support: It acts as a Progressive Web App (PWA) with offline capabilities (service worker) and local browser draft saving.
- Report Import: You can import existing
methodenanalyser-report-v1.jsonfiles to view them in the browser. - LAN Access: For cross-device testing (e.g. previewing on mobile devices), make the server listen on your local network:
This deliberate LAN test mode uses local HTTP without authentication or TLS. Use it only on a trusted private network; it is neither a cloud service nor a mobile product line. For further details, consult WEBAPP.md.
python webapp/server.py --host 0.0.0.0 --port 8765
While the GUI is optimized for Windows (using Tkinter), the codebase is fully verified to run from source on macOS and Linux. You can run unit tests and compile checks with:
python -m py_compile MethodenAnalyser3.py manage_translations.py translator.py webapp/server.py
python -m unittest discover -s tests -vThe repository includes a GitHub Actions workflow that executes this test suite across a matrix of Windows Server 2025 with Visual Studio 2026 (Python 3.10-3.12), Ubuntu (Python 3.11), and macOS 26 (Python 3.11).
For CI/CD scripts, the tool returns the following exit codes:
0= Analysis succeeded, no issues/findings detected.1= Syntax, argument, or analysis error.2= Analysis succeeded, but findings (unused code, similar blocks) were detected.3= Project analysis completed, but some individual files failed to parse.
=== ANALYSIS: my_script.py ===
IMPORTS (3 total):
os - active
json - active
pathlib - potentially unused
DEFINITIONS (5 total):
main()
load_config()
old_helper() - no references found
SIMILAR CODE BLOCKS (Threshold: 80%):
Lines 42-55 <-> Lines 88-101 (Similarity: 91%)
You can customize the detection parameters directly inside the source code:
SIMILARITY_THRESHOLD = 0.8 # Similarity threshold (0.0 to 1.0) for duplicate detection
WINDOW_GEOMETRY = "1200x700" # Desktop window dimensionsMethodenAnalyser operates 100% locally. Your Python code, local file paths, and analysis results are never sent over the internet. There are no analytics, cloud integrations, telemetry features, or third-party tracking scripts. The optional web helper binds to 127.0.0.1 by default. Its explicit --host 0.0.0.0 LAN test mode has no authentication or TLS and must be used only in a trusted private network.
Build, packaging, and sign-related files are configured in .gitignore to stay outside of the version control system.
- GitHub Remote:
dev-bricks/MethodenAnalyser - The public hygiene baseline is a named commit or tag, not a permanent snapshot
claim in this README. Before a release or handoff, run:
git branch --show-current,git rev-list --left-right --count master...origin/master, andgit status --short --ignored. - The expected gate is branch
master,0 0ahead/behind for the named baseline, and a clean tree. Uncommitted icon/asset changes remain outside this documentation slice and must not be adopted or discarded here. - Run a secret/privacy scan and the compile command below for that same named baseline; this document does not claim a time-sensitive scan result.
- Before committing: run
git status --short, execute a secret scan, and verify local compilation usingpython -m py_compile MethodenAnalyser3.py manage_translations.py translator.py.
# Verify Python syntax and AST compilation
python -m py_compile MethodenAnalyser3.py manage_translations.py translator.py webapp/server.py
# Run unit tests
python -m unittest discover -s tests -vFor the reproducible pytest/PyInstaller range and the build_exe.bat fallback,
see BUILD.md and _sources/CROSSCHECK.md.
GitHub Actions runs these smoke tests on every push. The runner labels are pinned to the current 2026 migration targets (windows-2025-vs2026 and macos-26) so the smoke matrix validates the same images that GitHub is moving windows-latest and macos-latest toward. For LLM agents and crawlers, a lightweight machine-readable context file is provided in llms.txt.
This project is licensed under the MIT License.
This project is a gratuitous open-source donation ("unentgeltliche Open-Source-Schenkung" under German Civil Code §§ 516 ff. BGB). Under German law (§ 521 BGB), liability is limited to intent and gross negligence. The standard MIT License disclaimer applies globally.
Use at your own risk. No support guarantees, no warranty for fitness for a particular purpose or error-free operation.

