Skip to main content

llvm-diagnostics

Python module for creating diagnostics using the LLVM diagnostics specification

Installation

% pip install llvm-diagnostics

Usage

Parsing a log file containing LLVM Diagnostics messages

Parsing a logging file can be done as follows:

from llvm_diagnostics.parser import diagnostics_messages_from_file

for error in list(diagnostics_messages_from_file("test/resources/test.out")):
   print(f"Diagnostics Message found:")
   print(f"  File: {error.file_path}")
   print(f"  Level: {error.level}")
   print(f"  Message: {error.message}")

Which will result in output similar to:

Diagnostics Message found:
  File: /code/supermarket-buyer-supplier/src/offers/convert_customer_receipt.cpp
  Level: DiagnosticsLevel.WARNING
  Message: 'fruit_section' is deprecated: 2021.Q2 Deprecated Use application::supermarket_app::receipt_engine::receipt::FruitInformation::fruit_section_labels [-Wdeprecated-declarations]

Reporting on Diagnostics messages

You can use llvm-diagnostics to create your own Diagnostics messages.

Reporting a message in LLVM Diagnostics format

import llvm_diagnostics as logger

message = logger.Warning(
   file_path='fake_file.py',
   line_number=logger.Range(start=10),
   column_number=logger.Range(start=15, range=3),
   line="mPercentage = 105",
   expectations="100",
   message='Value exceeds maximum, automatically capped to 100',
).report()

This will result in the following message on stderr:

example

Reporting a message in GitHub format

import llvm_diagnostics as logger

logger.config(logger.formatters.GitHub())

message = logger.Warning(
   file_path='fake_file.py',
   line_number=logger.Range(start=10),
   column_number=logger.Range(start=15, range=3),
   line="mPercentage = 105",
   expectations="100",
   message='Value exceeds maximum, automatically capped to 100',
).report()

This will result in the following message on stderr:

::warning file=fake_file.py,line=10,col=15,endColumn=18::Value exceeds maximum, automatically capped to 100

Metadata

Release files for llvm-diagnostics 3.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llvm-diagnostics 3.0.1
File Size Uploaded Provenance Actions
llvm-diagnostics-3.0.1.tar.gz 35.6 kB Without provenance Details for llvm-diagnostics-3.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llvm-diagnostics 3.0.1
File Interpreter ABI Platform Actions
llvm_diagnostics-3.0.1-py3-none-any.whl Python 3 none any Details for llvm_diagnostics-3.0.1-py3-none-any.whl

Total release size: 46.9 kB

Release files / llvm-diagnostics-3.0.1.tar.gz

Download URL llvm-diagnostics-3.0.1.tar.gz
Size 35.6 kB
Tags Source
SHA-256 checksum
How to use checksums
67470811bbab34bf75d6ef298d6a6f35b1133c710e8fc15c793eb6755d07215f
BLAKE2b-256 checksum
How to use checksums
1017ecb54db99380a8f0c332bf286a586c202925043ab4b1667ca9dee9ffac6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.17

Release files / llvm_diagnostics-3.0.1-py3-none-any.whl

Download URL llvm_diagnostics-3.0.1-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
51aac4c0a29dc4bcd21c15bd7e2c050f2e5d59ef95ae0e8a1e0174b7964a386c
BLAKE2b-256 checksum
How to use checksums
fb8f35f24961ecd06a81edface2212e7c32ea580c640943fd8a27e7a9b58f6b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.17

Security for llvm-diagnostics 3.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page