Using Python API #2388
|
Hello everyone, I also noticed the last commit touching the swig/ folder is about 3 years old, with very little recent activity or documentation/examples for modern use cases (SDS handling, tailoring, etc.). Does anyone have a working, modern example of loading a full Source Data Stream (selecting datastream-id + xccdf-id) through this binding? |
Replies: 1 comment 1 reply
|
The bindings are not completely abandoned, but I would not choose the high-level There are two different maintenance stories in the tree:
The current SDS-capable API is the C For a production Python service, my recommendation is therefore: subprocess.run([
"oscap", "xccdf", "eval",
"--datastream-id", datastream_id,
"--xccdf-id", xccdf_id,
"--profile", profile_id,
"--tailoring-file", tailoring_file,
"--results", results_xml,
"--results-arf", results_arf,
sds_path,
], check=False)Parse If in-process callbacks are a hard requirement, use the public C So the practical answer is: bindings still build and receive compatibility fixes, but the high-level Python wrapper is legacy/best-effort for modern SDS workflows; CLI + result XML is the safest supported integration for a new Python project, and direct C is the path when callbacks/in-process control justify the extra complexity. |
The bindings are not completely abandoned, but I would not choose the high-level
openscap_api.pywrapper as the primary interface for a new SDS-based application.There are two different maintenance stories in the tree:
ENABLE_PYTHON3defaults on when Python/SWIG are present), have binding tests, and even received a compiler-compatibility fix in January 2024. So they are not formally removed/deprecated.openscap_api.pyis much less complete. ItsDS_Classis empty andxccdf.init()imports a standalone benchmark plus referenced OVAL files; it does not implement the modern SDS/session selection workflow. The callback h…