Skip to main content

A viral hybrid code-profiler and AI-linter.

Project description

PyFlex 💪

Python 3.9+

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!

Flex Card Demo

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 blame to 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!

SpeedRun Demo

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:

  1. Scans my_script.py using Python's ast module.
  2. Identifies the function with the highest cyclomatic complexity (most nested loops and if statements).
  3. Uses git blame to figure out who wrote it.
  4. Prints a hilarious, neon-bordered roast directly in your terminal.

Roast Demo

3. The Developer Flex Card

Generate a stunning "GitHub Stats Card" using your local Git history.

pyflex flex

What it does:

  1. Parses your local .git repository.
  2. Computes your Total Lines of Code (LOC) for Python files.
  3. Uses AST to count the total number of functions in your codebase.
  4. Calculates your longest consecutive commit streak in days.
  5. 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyflex_cli-0.1.2.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyflex_cli-0.1.2-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file pyflex_cli-0.1.2.tar.gz.

File metadata

  • Download URL: pyflex_cli-0.1.2.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyflex_cli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 da1e3d0a0ee597e403b6c10575e72ecfb7de1de9ce9a6f09e38f7011bce6805a
MD5 3aff2cec4e3bc29fc94a2ed30bdc0e47
BLAKE2b-256 a93f8583d5fbb22d6d0d2e133e3fc706411d9d9ff8b9940c4ea0eb21f33d8998

See more details on using hashes here.

File details

Details for the file pyflex_cli-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pyflex_cli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for pyflex_cli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 13c433e9a943a4f9b27c21102b075491551b5db435f740ad2abc47267fef7ca4
MD5 fed0d8cea7ffdc0697d150e10062ccab
BLAKE2b-256 063f2bf748259cf1b72be9f44ba03e44de07637b6d685cd0a797ae8e8c2e5eea

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page