Capture Everything. Elegantly.

A lightweight Python library that captures your function’s inputs, outputs, prints, and execution time, all with simple decorators. No boilerplate. No fuss.

What is PyTure?

PyTure is a lightweight Python library that captures everything about a function, inputs, outputs, print statements, return values, and even execution time.

It's built using a simple @capture decorator that adds full visibility without changing how you write code. Perfect for debugging, teaching, experimenting, or building smarter workflows.

One line. Full context. Pure Python.

@capture()

Decorator-powered magic 🪄

Just wrap and run.

Why PyTure?

Writing clean code is easy. But understanding what it’s doing under the hood, especially in real time, is often messy, repetitive, and time-consuming.

  • ❓ What arguments did this function receive?
  • 📤 What did it return, and what did it print?
  • ⏱️ How long did it take to run?
  • 🧪 How do I log this without adding extra clutter?

PyTure answers all of that with a single line of code. It's a one-line decorator that captures everything you need, no boilerplate, no setup.

Whether you’re debugging, teaching, or building a product, PyTure helps you see your code clearly, in real time.

Features

Why developers choose PyTure for their projects

Instant Capture

Wrap any function with @capture to instantly log inputs, outputs, prints, and runtime, all in one place.

🎨

Elegant Decorators

Zero-setup decorator design. Just add one line and let PyTure do the magic behind the scenes.

📁

Flexible Export

Export captured data to JSON or CSV, cleanly formatted, easy to analyze, or reload anytime.

📊

Session Aware

Each capture includes session ID and timestamp, so you can track exactly what happened and when.

🧪

Dev Mode Logging

Enable development mode to print live logs of every capture in real-time, ideal for debugging & testing.

Installation

Let’s install PyTure and start capturing in style.

bash
pip install pyture

Code Example

A real-world PyTure demo, capture values, monitor sessions, and save to JSON.

python

from pyture import Pyture  

# Start Pyture in dev mode (prints live captures)
p = Pyture(mode="dev")

# Track some key project variables
p.capture(project="Pyture", version="1.0.0", author="Shakib")

# Simulate a user signup event
def signup(username, email):
    p.capture(event="user_signup", username=username, email=email)
    return f"Welcome, {username}!"

signup("alice", "alice@example.com")
signup("bob", "bob@example.com")

# Log an error event
try:
    10 / 0
except ZeroDivisionError as e:
    p.capture(event="error", type="ZeroDivisionError", message=str(e))

# Save all captured data to a JSON file
p.save("session.json", mode="full")

# Export the same data to CSV
p.export_csv("session.csv")

# Quick session summary
print(p.get_session_info())

  

Terminal Output:

BASH

[Captured] {'project': 'Pyture', 'version': '1.0.0', 'author': 'Shakib'}
[Captured] {'event': 'user_signup', 'username': 'alice', 'email': 'alice@example.com'}
[Captured] {'event': 'user_signup', 'username': 'bob', 'email': 'bob@example.com'}
[Captured] {'event': 'error', 'type': 'ZeroDivisionError', 'message': 'division by zero'}
[Saved] (full) → session.json
[Exported] Data exported to 'session.csv'
{'session_id': 'c0e4a6f2-8a2e-49f1-9d1c-7fa95c1d8e4e', 'started_at': '2025-08-24T18:10:32.123456', 'captures': 4}

  

To learn more and explore usage, visit the PyTure Docs.

About the Creator

PyTure is created and maintained by Shakib Sayyed ,18 years-old self-taught developer passionate about competitive programming, AI, and building impactful tools. You can connect with me on GitHub or Linkedin .

I started PyTure with a simple goal, to make capturing and understanding program data easier, cleaner, and more enjoyable for developers. As someone who’s still learning and experimenting every day, I believe tools should empower creativity rather than get in the way. PyTure is my small step toward building open-source utilities that anyone, from beginners to experienced developers, can pick up and use instantly. This project will continue to evolve with community feedback, so every suggestion, bug report, or feature request is not just welcome but truly appreciated.

Your stars ⭐ and contributions keep this project alive!