Profyle, a development tool for analysing and managing python traces
Project description
Profyle
Development tool for analysing and managing python traces
Why do you need Profyle?
Bottlenecks
With Profyle you can easily detect where in your code you have a bottleneck, just analize the trace and see what function or operation is taking most of the request execution time
Enhance performace
Analize the traces and decide which parts of your code should be improved
Installation
$ pip install profyle
---> 100%
Example
1. Implement
In order to track all your API requests you must implement the ProfyleMiddleware
FastAPI
from fastapi import FastAPI
from profyle.middleware.fastapi import ProfyleMiddleware
app = FastAPI()
app.add_middleware(ProfyleMiddleware)
@app.get("/items/{item_id}")
async def read_item(item_id: int):
return {"item_id": item_id}
Flask
from flask import Flask
from profyle.middleware.flask import ProfyleMiddleware
app = Flask(__name__)
app.wsgi_app = ProfyleMiddleware(app.wsgi_app)
@app.route("/")
def hello_world():
return "<p>Hello, World!</p>"
Django
Soon..2. Run
- Run the web server:
$ profyle start
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [28720]
INFO: Started server process [28722]
INFO: Waiting for application startup.
INFO: Application startup complete.
3. List
- List all requests tracing:
4. Analyze
- Profyle stands on the shoulder of giants: Viztracer and Perfetto
- Detailed function entry/exit information on timeline with source code
- Super easy to use, no source code change for most features, no package dependency
- Supports threading, multiprocessing, subprocess and async
- Powerful front-end, able to render GB-level trace smoothly
- Works on Linux/MacOS/Window
CLI Commands
start
- Start the web server and view profile traces
$ profyle start
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [28720]
INFO: Started server process [28722]
INFO: Waiting for application startup.
INFO: Application startup complete.
clean
- Delete all profile traces
$ profyle clean
10 traces removed
check
- Check traces DB size
$ profyle check
DB size: 30MB
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
profyle-0.0.13.tar.gz
(55.2 kB
view hashes)
Built Distribution
profyle-0.0.13-py3-none-any.whl
(56.4 kB
view hashes)