tritonparse 0.3.1.dev20251030071508__tar.gz → 0.3.1.dev20251031071507__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of tritonparse might be problematic. Click here for more details.

Files changed (121) hide show
  1. {tritonparse-0.3.1.dev20251030071508/tritonparse.egg-info → tritonparse-0.3.1.dev20251031071507}/PKG-INFO +1 -1
  2. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/structured_logging.py +81 -8
  3. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507/tritonparse.egg-info}/PKG-INFO +1 -1
  4. tritonparse-0.3.1.dev20251031071507/website/src/components/CodeComparisonView.tsx +566 -0
  5. tritonparse-0.3.1.dev20251031071507/website/src/components/CodeViewer.css +95 -0
  6. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/components/CodeViewer.tsx +191 -133
  7. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/pages/CodeView.tsx +2 -2
  8. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/utils/dataLoader.ts +3 -0
  9. tritonparse-0.3.1.dev20251030071508/website/src/components/CodeComparisonView.tsx +0 -419
  10. tritonparse-0.3.1.dev20251030071508/website/src/components/CodeViewer.css +0 -43
  11. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/.ci/README.md +0 -0
  12. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/.ci/install-project.sh +0 -0
  13. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/.ci/install-triton.sh +0 -0
  14. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/.ci/run-tests.sh +0 -0
  15. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/.ci/setup.sh +0 -0
  16. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/.github/PAGES_SETUP.md +0 -0
  17. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/.github/workflows/deploy-pages-standalone.yml +0 -0
  18. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/.github/workflows/deploy-pages.yml +0 -0
  19. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/.github/workflows/nightly-pypi.yml +0 -0
  20. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/.github/workflows/test.yml +0 -0
  21. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/.gitignore +0 -0
  22. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/CHANGELOG.md +0 -0
  23. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/CODE_OF_CONDUCT.md +0 -0
  24. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/CONTRIBUTING.md +0 -0
  25. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/LICENSE +0 -0
  26. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/Makefile +0 -0
  27. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/README.md +0 -0
  28. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/__init__.py +0 -0
  29. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/pyproject.toml +0 -0
  30. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/run.py +0 -0
  31. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/setup.cfg +0 -0
  32. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tests/README.md +0 -0
  33. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tests/__init__.py +0 -0
  34. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tests/example_output/logs/dedicated_log_triton_trace_findhao_.ndjson +0 -0
  35. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tests/example_output/parsed_output/dedicated_log_triton_trace_findhao__mapped.ndjson.gz +0 -0
  36. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tests/example_output/parsed_output/f0_fc0_a0_cai-.ndjson.gz +0 -0
  37. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tests/example_output/parsed_output/log_file_list.json +0 -0
  38. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tests/example_output/parsed_output_complex/dedicated_log_triton_trace_findhao__mapped.ndjson.gz +0 -0
  39. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tests/example_output/parsed_output_complex/log_file_list.json +0 -0
  40. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tests/test_add.py +0 -0
  41. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tests/test_tritonparse.py +0 -0
  42. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/__init__.py +0 -0
  43. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/__main__.py +0 -0
  44. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/cli.py +0 -0
  45. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/common.py +0 -0
  46. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/context_manager.py +0 -0
  47. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/event_diff.py +0 -0
  48. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/extract_source_mappings.py +0 -0
  49. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/ir_analysis.py +0 -0
  50. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/ir_parser.py +0 -0
  51. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/mapper.py +0 -0
  52. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/reproducer/__init__.py +0 -0
  53. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/reproducer/cli.py +0 -0
  54. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/reproducer/function_extractor.py +0 -0
  55. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/reproducer/ingestion/ndjson.py +0 -0
  56. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/reproducer/orchestrator.py +0 -0
  57. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/reproducer/placeholder_replacer.py +0 -0
  58. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/reproducer/templates/__init__.py +0 -0
  59. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/reproducer/templates/example.py +0 -0
  60. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/reproducer/templates/loader.py +0 -0
  61. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/reproducer/templates/tritonbench.py +0 -0
  62. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/reproducer/types.py +0 -0
  63. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/reproducer/utils.py +0 -0
  64. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/shared_vars.py +0 -0
  65. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/source_type.py +0 -0
  66. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/sourcemap_utils.py +0 -0
  67. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/tools/__init__.py +0 -0
  68. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/tools/decompress_bin_ndjson.py +0 -0
  69. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/tools/disasm.py +0 -0
  70. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/tools/format_fix.py +0 -0
  71. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/tools/load_tensor.py +0 -0
  72. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/tools/prettify_ndjson.py +0 -0
  73. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/tools/readme.md +0 -0
  74. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/tp_logger.py +0 -0
  75. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/trace_processor.py +0 -0
  76. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse/utils.py +0 -0
  77. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse.egg-info/SOURCES.txt +0 -0
  78. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse.egg-info/dependency_links.txt +0 -0
  79. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse.egg-info/entry_points.txt +0 -0
  80. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse.egg-info/requires.txt +0 -0
  81. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/tritonparse.egg-info/top_level.txt +0 -0
  82. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/eslint.config.js +0 -0
  83. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/index.html +0 -0
  84. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/package-lock.json +0 -0
  85. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/package.json +0 -0
  86. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/public/dedicated_log_triton_trace_findhao__mapped.ndjson.gz +0 -0
  87. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/public/f0_fc0_a0_cai-.ndjson +0 -0
  88. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/public/favicon.ico +0 -0
  89. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/public/logo.svg +0 -0
  90. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/scripts/inline-html.js +0 -0
  91. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/scripts/update_deps.sh +0 -0
  92. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/App.css +0 -0
  93. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/App.tsx +0 -0
  94. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/assets/react.svg +0 -0
  95. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/components/ArgumentViewer.tsx +0 -0
  96. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/components/Callstack.tsx +0 -0
  97. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/components/CompilationInfo.tsx +0 -0
  98. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/components/CopyCodeButton.tsx +0 -0
  99. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/components/DataSourceSelector.tsx +0 -0
  100. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/components/DiffComparisonView.tsx +0 -0
  101. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/components/DiffViewer.tsx +0 -0
  102. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/components/ExternalLink.tsx +0 -0
  103. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/components/SingleCodeViewer.tsx +0 -0
  104. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/components/StackDiffViewer.tsx +0 -0
  105. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/components/ToggleSwitch.tsx +0 -0
  106. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/components/TritonIRs.tsx +0 -0
  107. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/components/WelcomeScreen.tsx +0 -0
  108. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/context/FileDiffSession.tsx +0 -0
  109. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/index.css +0 -0
  110. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/main.tsx +0 -0
  111. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/pages/FileDiffView.tsx +0 -0
  112. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/pages/IRAnalysis.tsx +0 -0
  113. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/pages/KernelOverview.tsx +0 -0
  114. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/utils/fbDetection.ts +0 -0
  115. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/utils/safeImport.ts +0 -0
  116. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/utils/tensor.ts +0 -0
  117. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/src/vite-env.d.ts +0 -0
  118. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/tsconfig.app.json +0 -0
  119. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/tsconfig.json +0 -0
  120. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/tsconfig.node.json +0 -0
  121. {tritonparse-0.3.1.dev20251030071508 → tritonparse-0.3.1.dev20251031071507}/website/vite.config.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tritonparse
3
- Version: 0.3.1.dev20251030071508
3
+ Version: 0.3.1.dev20251031071507
4
4
  Summary: TritonParse: A Compiler Tracer, Visualizer, and mini-Reproducer Generator for Triton Kernels
5
5
  Author-email: Yueming Hao <yhao@meta.com>
6
6
  License-Expression: BSD-3-Clause
@@ -48,6 +48,14 @@ TRITON_TRACE_LAUNCH = os.getenv("TRITON_TRACE_LAUNCH", None) in ["1", "true", "T
48
48
  TRITONPARSE_MORE_TENSOR_INFORMATION = os.getenv(
49
49
  "TRITONPARSE_MORE_TENSOR_INFORMATION", None
50
50
  ) in ["1", "true", "True"]
51
+ # Enable full Python source file extraction instead of just the function definition
52
+ TRITON_FULL_PYTHON_SOURCE = os.getenv("TRITON_FULL_PYTHON_SOURCE", "0") in [
53
+ "1",
54
+ "true",
55
+ "True",
56
+ ]
57
+ # Maximum file size for full source extraction (default 10MB)
58
+ TRITON_MAX_SOURCE_SIZE = int(os.getenv("TRITON_MAX_SOURCE_SIZE", str(10 * 1024 * 1024)))
51
59
  # Inductor compiled kernel's launch tracing needs this flag to be set.
52
60
  # If TRITON_TRACE_LAUNCH is enabled, also enable TORCHINDUCTOR_RUN_JIT_POST_COMPILE_HOOK
53
61
  TORCHINDUCTOR_RUN_JIT_POST_COMPILE_HOOK = (
@@ -727,6 +735,17 @@ def extract_python_source_info(trace_data: Dict[str, Any], source):
727
735
  from the provided source object (typically an ASTSource or IRSource instance).
728
736
  It adds file path, line numbers, and the actual source code to the trace_data.
729
737
 
738
+ By default, only the function definition is extracted. Set TRITON_FULL_PYTHON_SOURCE=1
739
+ to extract the entire Python source file.
740
+ @TODO: we should enable it by default in next diff and track the compilation time regression
741
+
742
+ Environment Variables:
743
+ TRITON_FULL_PYTHON_SOURCE: If set to "1", extract the full Python file
744
+ instead of just the function definition.
745
+ TRITON_MAX_SOURCE_SIZE: Maximum file size in bytes for full source extraction
746
+ (default: 10MB). Files larger than this will fall back
747
+ to function-only mode.
748
+
730
749
  Args:
731
750
  trace_data (Dict[str, Any]): Dictionary to store extracted information
732
751
  source (Union[ASTSource, IRSource]): Source object containing kernel function information
@@ -738,23 +757,77 @@ def extract_python_source_info(trace_data: Dict[str, Any], source):
738
757
  if isinstance(source, IRSource):
739
758
  return
740
759
 
741
- # Get the original Python source code for the kernel
760
+ # Get the function reference
761
+ if isinstance(fn := source.fn, JITFunction):
762
+ fn_ref = fn.fn
763
+ else:
764
+ fn_ref = source.fn
765
+
766
+ python_source_file = inspect.getfile(fn_ref)
767
+
768
+ # Get function range information
742
769
  if (
743
770
  isinstance(fn := source.fn, JITFunction)
744
771
  and hasattr(fn, "starting_line_number")
745
772
  and hasattr(fn, "raw_src")
746
773
  ):
747
- start_line_number = fn.starting_line_number
774
+ function_start_line = fn.starting_line_number
748
775
  source_lines = fn.raw_src
749
776
  else:
750
- source_lines, start_line_number = inspect.getsourcelines(fn.fn)
777
+ source_lines, function_start_line = inspect.getsourcelines(fn_ref)
778
+
779
+ function_end_line = function_start_line + len(source_lines) - 1
780
+
781
+ if TRITON_FULL_PYTHON_SOURCE:
782
+ # Full file mode: read the entire Python file
783
+ try:
784
+ # Check file size before reading
785
+ file_size = os.path.getsize(python_source_file)
786
+ except OSError as e:
787
+ log.warning(
788
+ f"Failed to check file size for {python_source_file}: {e}. "
789
+ f"Falling back to function-only mode."
790
+ )
791
+ use_full_source = False
792
+ else:
793
+ if file_size > TRITON_MAX_SOURCE_SIZE:
794
+ log.warning(
795
+ f"Source file {python_source_file} is too large ({file_size} bytes, "
796
+ f"limit: {TRITON_MAX_SOURCE_SIZE} bytes). Falling back to function-only mode."
797
+ )
798
+ use_full_source = False
799
+ else:
800
+ use_full_source = True
801
+
802
+ if use_full_source:
803
+ try:
804
+ with open(python_source_file, "r", encoding="utf-8") as f:
805
+ file_content = f.read()
806
+
807
+ # Calculate total lines
808
+ total_lines = len(file_content.split("\n"))
809
+
810
+ trace_data["python_source"] = {
811
+ "file_path": python_source_file,
812
+ "start_line": 1,
813
+ "end_line": total_lines,
814
+ "code": file_content,
815
+ # Add function range for frontend highlighting and scrolling
816
+ "function_start_line": function_start_line,
817
+ "function_end_line": function_end_line,
818
+ }
819
+ return
820
+ except (OSError, UnicodeDecodeError) as e:
821
+ log.warning(
822
+ f"Failed to read full source file {python_source_file}: {e}. "
823
+ f"Falling back to function-only mode."
824
+ )
751
825
 
752
- python_source_file = inspect.getfile(fn.fn)
753
- end_line_number = start_line_number + len(source_lines)
826
+ # Default behavior: only extract function definition
754
827
  trace_data["python_source"] = {
755
828
  "file_path": python_source_file,
756
- "start_line": start_line_number,
757
- "end_line": end_line_number,
829
+ "start_line": function_start_line,
830
+ "end_line": function_end_line,
758
831
  "code": "".join(source_lines),
759
832
  }
760
833
 
@@ -910,7 +983,7 @@ class TritonTraceHandler(logging.StreamHandler):
910
983
  )
911
984
  elif not os.access(TRACE_LOG_DIR, os.W_OK):
912
985
  log.info(
913
- "TritonTraceHandler: disabled because %s is not writeable",
986
+ "TritonTraceHandler: disabled because %s is not writable",
914
987
  TRACE_LOG_DIR,
915
988
  )
916
989
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tritonparse
3
- Version: 0.3.1.dev20251030071508
3
+ Version: 0.3.1.dev20251031071507
4
4
  Summary: TritonParse: A Compiler Tracer, Visualizer, and mini-Reproducer Generator for Triton Kernels
5
5
  Author-email: Yueming Hao <yhao@meta.com>
6
6
  License-Expression: BSD-3-Clause