Metadata-Version: 2.1
Name: pysarif
Version: 0.1.0
Summary: Package to work with SARIF files as Python objects
Author-email: Kjeld Perquin <kjeld.perquin96@gmail.com>
License: MIT License
        
        Copyright (c) 2023 KjeldP
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: homepage, https://github.com/Kjeld-P/pysarif
Project-URL: documentation, https://github.com/Kjeld-P/pysarif/issues
Project-URL: repository, https://github.com/Kjeld-P/pysarif
Keywords: sarif,pysarif,package
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Topic :: Security
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Provides-Extra: dev
License-File: LICENSE

# PySarif

This package provides a simple way to load, save, and interact with SARIF files. 

The SARIF file, once loaded, can be interacted with like a normal Python object.

Nearly all of the code has been automatically generated from the [SARIF JSON Schema](https://github.com/oasis-tcs/sarif-spec/raw/main/Documents/CommitteeSpecifications/2.1.0/sarif-schema-2.1.0.json) using a modified version of Microsoft's [jschema-to-python](https://github.com/microsoft/jschema-to-python) package. The modified version can be found in [generator](./generator/). 

## Quickstart
`pip install pysarif`

```py
from pysarif import load_from_file, save_to_file

sarif = load_from_file("/path/to/sarif.sarif")
for rule in sarif.runs[0].tool.driver.rules:
    print(rule.name)

save_to_file(sarif, "/path/to/new/sarif.sarif")
```
## What about existing packages?
Microsoft offers the [sarif-om](https://github.com/microsoft/sarif-python-om) package. Sadly, they do not provide any way to load an existing SARIF file into their object model, nor do they provide a way to serialize the object model into a SARIF file. As such, I believe there is currently no (easy) way to work with SARIF files in Python, other than working with it as a dict.
