Skip to main content

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

  1. Authenticate with the Hugging Face Hub.
  2. Create the bucket (exist_ok=True, so re-runs are fine).
  3. sync_bucket your local folder into the bucket.
  4. 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

Apache-2.0

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

trace_util-0.2.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

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

trace_util-0.2.0-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

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

Hashes for trace_util-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1a843e30a66205cf96c245f0711edfdb3108e742acdb4682d31dbb494f9b64b0
MD5 dc6f7b72336a47908e663b19e2e5d1cd
BLAKE2b-256 25dd096f262f17384a2f7d13d3d2415443dcd52b3038a3234e131479080f3e29

See more details on using hashes here.

Provenance

The following attestation bundles were made for trace_util-0.2.0.tar.gz:

Publisher: publish.yml on ariG23498/trace-util

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for trace_util-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 31336343132f98ee73d874c12523a15f7a552a736a81f7b33153afab407cbcc0
MD5 372ba1c9f1eca218a8bff390f11fe6d8
BLAKE2b-256 afabfa467cdaf69b2ae46615613672a3e87b8da33af0d250070a65d4476973e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for trace_util-0.2.0-py3-none-any.whl:

Publisher: publish.yml on ariG23498/trace-util

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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