Python class to validate, convert and manage OSCAL content.
Project description
OSCAL Python Library
This is a collection of python modules for OSCAL XML, JSON and YAML content. It provides classes for OSCAL content. The classes are able to perform validation, format conversion and some content manipulation.
It handles all published OSCAL versions, and can "learn" new versions as they are published by NIST.
Please submit feedback, bug reports and enhancement requests as GitHub issues. Bug fixes and backward-compatible code contributions are welcome. Please consider collaborating on any breaking enhancements.
Designed for Air Gapped Environments
The OSCAL_support class includes an OSCAL Support Module. This is a single SQLite3 database file that contains the NIST-published support files for all OSCAL formats, versions and models. The module enables support functionality in an air gapped environment.
When a new version of OSCAL is published, the support module can be updated on an Internet-connected computer and conveyed into an air gapped environment for use.
Inspection
Inspection of the OSCAL Support Module is possible using any SQLite database viewer. Note that the suport files are ZIP compressed within the database; however, no encryption is used in order to facilitate inspection.
For more information see the Support Module documentation.
Setup
The Python OSCAL Class is intended to be used as a library for your OSCAL python projects.
Add the following to your requirements.txt file or pyproject.toml file:
-
Latest published verson use:
oscal -
Most up-to-date, unpublished version use:
git+https://github.com/brian-ruf/oscal-class.git@develop#egg=oscal
Please see the Setup documentation for setup instructions and related details.
Usage: Quick Start
Installation
pip install oscal
To use the OSCAL class in your code, import the oscal_content_class module from the oscal library:
from oscal import oscal_content_class as oscal_content
# Create a new OCAL catalog object
oscal_catalog_obj = oscal_content.create_new_oscal_content(
model_name="catalog",
title="My Catalog",
version="DRAFT-1.0",
published="2026-03-02T00:00:00Z")
Instantiate the OSCAL class
Open OSCAL content directly from a file:
from oscal import oscal_content_class as oscal_content
oscal_catalog_obj = oscal_content_class.OSCAL(filename="./catalog.xml")
if oscal_catalog_obj:
oscal_catalog_obj.save("test_catalog.json", format="json", pretty_print=True)
oscal_catalog_obj.save("test_catalog.xml", format="xml", pretty_print=True)
oscal_catalog_obj.save("test_catalog.yaml", format="yaml", pretty_print=True)
Use an existing OSCAL string:
oscal_content = """
<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="http://csrc.nist.gov/ns/oscal/1.0" uuid="8e38fb28-f88e-4c3b-ac72-c39511a51f65">
<metadata>
<title>Control Catalog Template</title>
<published>2025-09-10T12:00:00-04:00</published>
<last-modified>2025-09-10T12:00:00-04:00</last-modified>
<version>DRAFT</version>
<oscal-version>1.1.3</oscal-version>
</metadata>
</catalog>
"""
oscal_catalog_obj = oscal_content_class.OSCAL(content=oscal_content)
Create new OSCAL content using the create_new_oscal_content function:
oscal_catalog_obj = oscal_content_class.create_new_oscal_content("catalog", "Control Catalog Title")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oscal-1.0.0.tar.gz.
File metadata
- Download URL: oscal-1.0.0.tar.gz
- Upload date:
- Size: 8.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb91c82556d0fccd93c5e338a32fce0ba139c45a7f02c684fa3d6a04162b6434
|
|
| MD5 |
4d94fea20669b135e4862df8d81c520b
|
|
| BLAKE2b-256 |
1259df553360ead4bdd3257403735c9811e7eddcd73d509edb9a35a01f13563c
|
Provenance
The following attestation bundles were made for oscal-1.0.0.tar.gz:
Publisher:
publish.yml on brian-ruf/oscal-class
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oscal-1.0.0.tar.gz -
Subject digest:
cb91c82556d0fccd93c5e338a32fce0ba139c45a7f02c684fa3d6a04162b6434 - Sigstore transparency entry: 1062810736
- Sigstore integration time:
-
Permalink:
brian-ruf/oscal-class@a91339521664b08937bf2bcd3348577d71245ad4 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/brian-ruf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a91339521664b08937bf2bcd3348577d71245ad4 -
Trigger Event:
release
-
Statement type:
File details
Details for the file oscal-1.0.0-py3-none-any.whl.
File metadata
- Download URL: oscal-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52d642217b8ba45c5ce7021066ac4e54a118e23dbce3bb9cc585782e7ffc8ee3
|
|
| MD5 |
a21ab89900153b20bce5142e169044ee
|
|
| BLAKE2b-256 |
804ae4f524985fcfbc35f68a617af1ced04b232dc87ed8cceea3f9be41ca3dbe
|
Provenance
The following attestation bundles were made for oscal-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on brian-ruf/oscal-class
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oscal-1.0.0-py3-none-any.whl -
Subject digest:
52d642217b8ba45c5ce7021066ac4e54a118e23dbce3bb9cc585782e7ffc8ee3 - Sigstore transparency entry: 1062810786
- Sigstore integration time:
-
Permalink:
brian-ruf/oscal-class@a91339521664b08937bf2bcd3348577d71245ad4 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/brian-ruf
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@a91339521664b08937bf2bcd3348577d71245ad4 -
Trigger Event:
release
-
Statement type: