PyTure Docs

Quick Start

Get up and running with PyTure in minutes.

1. Import & Initialize

First, import Pyture and create an instance. Use normal for production or dev for debug logs.

python
from pyture import Pyture

pt = Pyture(mode='normal')

Normal mode runs quietly without printing debug messages.


python
from pyture import Pyture

pt = Pyture(mode='dev')

Dev mode prints logs each time you capture, save, or load data, helpful for debugging.




2. Capture Data

Use the capture() method to log key–value pairs. Each capture is timestamped and tagged with a session ID.

python
pt.capture(user='alice', action='login')
pt.capture(user='bob', action='logout')

3. Save Data

Captured data can be saved to a JSON file using save(). By default, it saves in full mode (timestamp + session ID + data).

python
pt.save("captures.json")

Example output (captures.json):

json
[
  {
    "timestamp": "2025-08-17T14:22:36.481902",
    "session_id": "8f2b1d43-3e21-4a8d-9132-52f4c8e2b7ab",
    "data": {
      "user": "alice",
      "action": "login"
    }
  },
  {
    "timestamp": "2025-08-17T14:23:01.792145",
    "session_id": "8f2b1d43-3e21-4a8d-9132-52f4c8e2b7ab",
    "data": {
      "user": "bob",
      "action": "logout"
    }
  }
]
Success! You've created your first PyTure capture and saved it to JSON. Your data is now safely stored and ready for analysis.