{"library":"license-expression","code":"from license_expression import get_spdx_licensing\n\n# Get a licensing object. This can be slow and should be reused.\nlicensing = get_spdx_licensing()\n\n# Parse a license expression\nexpression_str = 'GPL-2.0-only OR LGPL-2.1-only AND MIT'\nparsed_expression = licensing.parse(expression_str)\n\nprint(f\"Original: {expression_str}\")\nprint(f\"Parsed (pretty): {parsed_expression.pretty()}\")\n\n# Check for equivalence\nexpression_str_2 = 'MIT AND (GPL-2.0-only OR LGPL-2.1-only)'\nparsed_expression_2 = licensing.parse(expression_str_2)\nprint(f\"Is '{expression_str}' equivalent to '{expression_str_2}'? {licensing.is_equivalent(parsed_expression, parsed_expression_2)}\")\n\n# Validate an expression\nvalid = licensing.validate(expression_str)\nprint(f\"Is '{expression_str}' a valid expression? {valid.errors if valid.errors else True}\")\n\ninvalid_expression = 'Invalid-License AND Other-License'\ninvalid_valid = licensing.validate(invalid_expression)\nprint(f\"Is '{invalid_expression}' a valid expression? {invalid_valid.errors if invalid_valid.errors else True}\")","lang":"python","description":"This quickstart demonstrates how to initialize the SPDX licensing engine and use it to parse, pretty-print, check equivalence, and validate license expressions. The `get_spdx_licensing()` call can be computationally intensive, so its result should be cached and reused.","tag":null,"tag_description":null,"last_tested":"2026-04-24","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}