--- id: nvtx version: "0.2.16" license: Apache-2.0 WITH LLVM-exception license_treatment: unclear maintenance: active --- # nvtx — Python NVTX - Python code annotation library License: unclear · Maintenance: active · Downloads: 2.1M/mo ## What it is and what it does nvtx is a Python wrapper around NVIDIA's NVTX (NVIDIA Tools Extension) library, allowing you to mark regions of Python code with named annotations and colors. When you run your code under NVIDIA Nsight Systems with the nvtx trace enabled, these annotations appear as labeled intervals in the profiler's timeline, making it easier to identify which functions and loops consume time during execution. The package provides decorators and context managers to annotate functions and code blocks, plus support for counter annotations and event payloads. It has no runtime dependencies and works on Linux (x86_64 and aarch64), Windows (x86_64 and ARM64), and supports Python 3.9 through 3.14. Annotations can be disabled via the NVTX_DISABLE environment variable for zero-overhead in production when profiling is not active. Use it for: - Profile GPU-accelerated Python applications to identify bottlenecks in compute kernels and data transfer. - Annotate machine learning training loops to visualize which stages (data loading, forward pass, backward pass) consume the most time. - Mark critical sections in multi-threaded or async code to correlate Python execution with GPU activity in Nsight Systems. - Add custom counter annotations to track metrics like batch size or loss during profiling sessions. - Instrument data processing pipelines to see where time is spent across preprocessing, model inference, and postprocessing stages. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. nvtx annotates Python code regions with named markers and colors for collection and visualization by NVIDIA Nsight Systems profiler. Yes, if you profile GPU-accelerated Python workloads with NVIDIA Nsight Systems. The package is actively maintained, has no runtime dependencies, supports current Python versions, and zero known vulnerabilities. The license treatment is unclear—verify the Apache-2.0 WITH LLVM-exception clause if you have strict licensing requirements. Install friction is medium due to platform-specific wheels, but prebuilt binaries are available. ## Install pip install nvtx uv add nvtx poetry add nvtx ## Installing nvtx Before you install: Medium install friction due to platform-specific wheels (manylinux, Windows, ARM64 variants across Python 3.10–3.14), but prebuilt binaries are available for all major platforms. Actively maintained with a release 2 days old. License in practice: Licensed under Apache-2.0 WITH LLVM-exception; license treatment is marked unclear, so verify the exception clause's implications for your use case before relying on this in proprietary or restricted-license contexts. Quickstart: import nvtx import time @nvtx.annotate(color="blue") def my_function(): with nvtx.annotate("my_loop", color="red"): time.sleep(1) my_function() Requires NVIDIA Nsight Systems to collect and visualize profiling data; annotations alone do nothing without an external profiler. Verify before relying: - Whether the LLVM-exception clause in the Apache-2.0 license affects commercial or closed-source use. - Performance overhead of annotation decorators in production code paths. ## Package facts - License: Apache-2.0 WITH LLVM-exception (unclear) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 2.1M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags python profiling annotations, nvidia nsight integration, code region markers, performance profiling decorators, nvtx profiler, nvidia tracing extensions, function timing annotations, profiling, nvidia-tools, performance-analysis [View on SkillFed](https://skillfed.io/packages/nvtx) · [View on PyPI](https://pypi.org/project/nvtx/)