A Python library that analyzes code complexity and provides human-friendly explanations.
Project description
TalkMyCode
A Python library that analyzes code complexity and provides human-friendly explanations, like a coding mentor.
Installation
-
Clone the repository:
git clone https://github.com/yourusername/talkmycode.git cd talkmycode
-
Install dependencies:
pip install -r requirements.txt
-
Install the package:
pip install -e .
Usage
Analyze a Python file:
analyze-code path/to/your/file.py
Options:
--mode: Choose explanation mode (friendly, strict, mentor). Default: friendly--speak: Enable text-to-speech for explanations
Example:
analyze-code example.py --mode mentor --speak
Example Output
Overall Complexity Score: 15
Readability Score: 85.50
Halstead Volume: 120.50
Halstead Difficulty: 5.20
Halstead Effort: 626.60
Issues:
- Function 'long_func' is too long (25 lines). Consider breaking it into smaller functions.
Suggestions:
- Break 'long_func' into smaller, focused functions.
Explanations:
- Hey! Your function 'long_func' is quite long. Long functions can be hard to understand. Try splitting it into smaller pieces!
Features
- AST-based code analysis
- Cyclomatic complexity calculation
- Detection of long functions, deep nesting, nested ifs
- Human-friendly explanations in different modes
- Actionable suggestions for improvements
- Text-to-speech support
- CLI interface
Contributing
Feel free to contribute by opening issues or pull requests.
License
MIT License
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 talkmycode-0.1.0.tar.gz.
File metadata
- Download URL: talkmycode-0.1.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ab43aeac02b65af59f22459dc1dfe8c5e0a693b78f7c4b9fa47e30cfd3ae686
|
|
| MD5 |
b6df7c7761a1271c35f66ba0738ecca9
|
|
| BLAKE2b-256 |
4a36f297edda74a710bf4354f36c8ad284e40cf6120b5f0f2c2744a7681dd4a3
|
File details
Details for the file talkmycode-0.1.0-py3-none-any.whl.
File metadata
- Download URL: talkmycode-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4339884c430580f50d74ea6483d1367f9c3efd302d67527ed3da927c5a5cf06c
|
|
| MD5 |
3b4f58192d77555e982835147c08ee20
|
|
| BLAKE2b-256 |
b0af2f034a355c0f10b3f0e77efab7a5d45d604a8d4ccb3b0811cc54498cc87d
|