PyFlex 💪
A viral, highly shareable hybrid code-profiler and AI-linter designed purely for developer pride. Benchmark your functions, roast your code, and generate beautiful terminal outputs that you can screenshot and share on LinkedIn and X!
Features
- ⏱ SpeedRun Decorator: Measure exact execution time, peak memory footprint, and guess the Big-O complexity of your functions.
- 🖼 Export to Image: Export your SpeedRun Certificates as beautiful SVGs instantly.
- 🍝 AI Roaster CLI: Statically analyzes your Python files, finds the function with the worst cyclomatic complexity, runs
git blameto find the author, and generates a humorous roast inside a neon terminal panel. - 🏆 Developer Flex Card: Parses your local Git repository to calculate your Total LOC, total functions, maximum commit streak, and 30-day coding volume into a sleek, viral Stats Card!
Installation
pip install pyflex
Usage
🖼 Exporting Images
Every PyFlex command and decorator supports exporting its beautiful terminal output directly to an SVG image! This is perfect for sharing on X (Twitter) or LinkedIn.
For CLI commands, simply append --export <filename.svg>:
pyflex flex --export my_flex_card.svg
pyflex roast examples/dummy.py --export roast_demo.svg
For the decorator, simply add the export_path argument: @speedrun(export_path="my_speedrun.svg")
1. The @speedrun Decorator
Add the @speedrun decorator to your functions to benchmark them and get a beautifully formatted "SpeedRun Certificate".
from pyflex import speedrun
@speedrun(guess_complexity=True, export_path="my_function.svg")
def my_complex_function(n: int):
# Some intensive logic...
return sum(i * i for i in range(n))
my_complex_function(100)
Output:
A stunning Rich-formatted table in your terminal showing the Execution Time, Peak Memory, Estimated Big-O complexity, and your assigned Rank (e.g., "S-Tier: The Alchemist" or "F-Tier: The Spaghetti Chef"). If export_path is specified, it saves an SVG image ready for social media!
2. The AI Roaster CLI
Want to publicly roast your coworkers (or yourself) for writing spaghetti code? Use the pyflex roast command.
pyflex roast examples/dummy.py
What it does:
- Scans
my_script.pyusing Python'sastmodule. - Identifies the function with the highest cyclomatic complexity (most nested loops and
ifstatements). - Uses
git blameto figure out who wrote it. - Prints a hilarious, neon-bordered roast directly in your terminal.
3. The Developer Flex Card
Generate a stunning "GitHub Stats Card" using your local Git history.
pyflex flex
What it does:
- Parses your local
.gitrepository. - Computes your Total Lines of Code (LOC) for Python files.
- Uses AST to count the total number of functions in your codebase.
- Calculates your longest consecutive commit streak in days.
- Tallies how many lines of code you wrote in the last 30 days!
Made for developers who want to show off their O(1) algorithms or get roasted for their O(N^2) loops.
Metadata
Release files for pyflex-cli 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyflex_cli-0.1.3.tar.gz | 9.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyflex_cli-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.2 kB
Release files / pyflex_cli-0.1.3.tar.gz
| Download URL | pyflex_cli-0.1.3.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
491d6c4d2230520d3a09e7ae0c850d6c343cb012481a6c4d88186ac9c5a42d67
|
|
BLAKE2b-256 checksum How to use checksums |
a70c823261e134974321efa04099e9047d678656c139173a855814879508e895
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / pyflex_cli-0.1.3-py3-none-any.whl
| Download URL | pyflex_cli-0.1.3-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
babbd5fbea9a3f1e0041ac82c3675ce6428f57763b9a2f3b373c2e14a52afe3a
|
|
BLAKE2b-256 checksum How to use checksums |
0f151d5d6c2903a5f993c38c71267929a10798c5341a1e93fa93e1a2a8bcce13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|