cwe2 is a Python library for working with the Common Weakness Enumeration (CWE) dictionary. Version 3.0.0 provides access to CWE data including weaknesses, categories, and views. The library is actively maintained with periodic releases.
pip install cwe2No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initialize CWE object and fetch a weakness by its CWE-ID. The library downloads the CWE data on first use.
Update imports to 'from cwe2 import CWE' and access attributes like weakness.name instead of weakness['name'].
Ensure internet connectivity. Set CWE_CACHE_DIR environment variable to a writable path if default (e.g., ~/.cwe) is not accessible.
Always pass full CWE ID string, e.g., 'CWE-79'.