Upload PyTorch profiler traces to a Hugging Face bucket and get shareable Perfetto UI links.
Project description
trace-util
Upload your PyTorch profiler traces to a Hugging Face bucket and get back ready-to-open Perfetto UI links — printed straight to your terminal.
## Perfetto URLs ##
0 aritra/aritra.json
https://ui.perfetto.dev/#!/?url=https://huggingface.co/.../resolve/aritra/aritra.json
1 something/something.json
https://ui.perfetto.dev/#!/?url=https://huggingface.co/.../resolve/something/something.json
Install
# one-off run, no install (recommended)
uvx trace-util -b my-bucket -f ./traces
# or install into your environment
pip install trace-util
uv pip install trace-util
Usage
1. From the command line (recommended)
After running a PyTorch profiler and dumping the traces into a folder:
uvx trace-util -b my-bucket -f ./traces
| Flag | Description |
|---|---|
-b, --bucket-name |
Name of the Hugging Face bucket to sync to (created if missing). Required. |
-f, --folder-path |
Local folder containing the traces. Required. |
--token |
Hugging Face token. Defaults to a cached / interactive login. |
--no-delete |
Keep files already in the bucket that are not present locally (do not mirror). |
--no-color |
Disable colored output (the NO_COLOR env var is also honored). |
You can also run it as a module: python -m trace_util -b my-bucket -f ./traces.
2. Programmatically
The upload logic lives in trace_util.core.upload_traces, which returns the
data instead of printing it — drop it into your own profiling scripts:
from trace_util import upload_traces
links = upload_traces(
bucket_name="my-bucket",
folder_path="./traces",
delete=True, # mirror the folder exactly
do_login=False, # skip login if HF_TOKEN is already set in the env
)
for link in links:
print(link.path, "->", link.perfetto_url)
upload_traces returns a list of TraceLink(path, perfetto_url) named tuples.
If you only want the URL formatting, use trace_util.format_perfetto_url.
How it works
- Authenticate with the Hugging Face Hub.
- Create the bucket (
exist_ok=True, so re-runs are fine). sync_bucketyour local folder into the bucket.- List the bucket tree and turn every file into a Perfetto
?url=link.
Note: Perfetto fetches the trace from the URL in your browser, so the bucket files need to be reachable by Perfetto. The links print as plain text so they stay copy/curl-able on any terminal.
Development
This project uses uv.
uv sync # create the environment
uv run trace-util --help
uv build # build the sdist + wheel into dist/
License
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trace_util-0.2.0.tar.gz.
File metadata
- Download URL: trace_util-0.2.0.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a843e30a66205cf96c245f0711edfdb3108e742acdb4682d31dbb494f9b64b0
|
|
| MD5 |
dc6f7b72336a47908e663b19e2e5d1cd
|
|
| BLAKE2b-256 |
25dd096f262f17384a2f7d13d3d2415443dcd52b3038a3234e131479080f3e29
|
Provenance
The following attestation bundles were made for trace_util-0.2.0.tar.gz:
Publisher:
publish.yml on ariG23498/trace-util
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trace_util-0.2.0.tar.gz -
Subject digest:
1a843e30a66205cf96c245f0711edfdb3108e742acdb4682d31dbb494f9b64b0 - Sigstore transparency entry: 1927467592
- Sigstore integration time:
-
Permalink:
ariG23498/trace-util@ce113aff50ae3f0b19fe49cc758a1f1f5b19c102 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/ariG23498
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ce113aff50ae3f0b19fe49cc758a1f1f5b19c102 -
Trigger Event:
push
-
Statement type:
File details
Details for the file trace_util-0.2.0-py3-none-any.whl.
File metadata
- Download URL: trace_util-0.2.0-py3-none-any.whl
- Upload date:
- Size: 10.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31336343132f98ee73d874c12523a15f7a552a736a81f7b33153afab407cbcc0
|
|
| MD5 |
372ba1c9f1eca218a8bff390f11fe6d8
|
|
| BLAKE2b-256 |
afabfa467cdaf69b2ae46615613672a3e87b8da33af0d250070a65d4476973e1
|
Provenance
The following attestation bundles were made for trace_util-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on ariG23498/trace-util
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
trace_util-0.2.0-py3-none-any.whl -
Subject digest:
31336343132f98ee73d874c12523a15f7a552a736a81f7b33153afab407cbcc0 - Sigstore transparency entry: 1927467666
- Sigstore integration time:
-
Permalink:
ariG23498/trace-util@ce113aff50ae3f0b19fe49cc758a1f1f5b19c102 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/ariG23498
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ce113aff50ae3f0b19fe49cc758a1f1f5b19c102 -
Trigger Event:
push
-
Statement type: