cwe2
cwe2 is a CWE common weakness enumeration library for Python
Decision gist · record as of 2026-08-14
Yes, if you need to programmatically look up CWE weakness data in a Python application. The package is stable, has no known vulnerabilities, and low install friction. The main caveat is dormant maintenance—the vendored CWE data may lag behind MITRE's official updates, so verify the data freshness suits your use case before relying on it for critical security decisions.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low install friction with a single lightweight dependency (importlib-resources).
- Maintenance is dormant—last commit was 2024-08-29 and no releases in over a year, though the repository remains active and the package is marked Production/Stable.
License · maintenance · safety
permissive license (permissive) — Dual-licensed under MIT and LicenseRef-scancode-cwe-tou. The CWE data itself carries MITRE's terms of use; permissive for code but you must respect MITRE's CWE usage terms when distributing or relying on the weakness data.
last release 2024-07-24 (751 days) · last repo commit 2024-08-29 · 15 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 78,876 downloads/mo, #14,400 on PyPI
Alternatives
Verify before relying
pip install cwe2
from cwe2.database import Database
db = Database()
weakness = db.get(15)
print(weakness.description)- Whether the vendored CWE data is kept current with MITRE's official CWE updates, given the dormant maintenance status.
- Performance characteristics when querying large numbers of weaknesses or iterating the full database.
What it is and what it does
cwe2 is a Python wrapper around the Common Weakness Enumeration (CWE) database maintained by MITRE. It bundles a vendored copy of the CWE data and exposes it through a simple query interface, letting you fetch weakness records by ID and access their structured attributes—name, description, related weaknesses, mitigation strategies, and more. The package is useful for security tools, vulnerability scanners, and code analysis systems that need to resolve CWE IDs to human-readable weakness information.
The library requires Python 3.7 or later and has minimal dependencies. It provides convenience methods to retrieve curated subsets like the top 25 CWEs, OWASP top ten 2021 weaknesses, and those used by the National Vulnerability Database (NVD). Maintenance is dormant but the package is stable and carries no known security vulnerabilities.
Use it for
- Resolve CWE IDs in vulnerability reports to fetch full weakness descriptions and mitigation guidance.
- Build security dashboards or scanners that need to display MITRE CWE metadata alongside CVE findings.
- Analyze code or dependencies and map detected weakness categories to their MITRE definitions for compliance reporting.
- Query curated CWE lists like top 25 or OWASP top ten 2021 for security training or policy enforcement.
- Enrich vulnerability data pipelines with standardized CWE weakness context and related attack patterns.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to programmatically look up CWE weakness data in a Python application.
The package is stable, has no known vulnerabilities, and low install friction. The main caveat is dormant maintenance—the vendored CWE data may lag behind MITRE's official updates, so verify the data freshness suits your use case before relying on it for critical security decisions.
Install
cwe2 on PyPI
Before you install
Low install friction with a single lightweight dependency (importlib-resources). Maintenance is dormant—last commit was 2024-08-29 and no releases in over a year, though the repository remains active and the package is marked Production/Stable.
License in practice
Dual-licensed under MIT and LicenseRef-scancode-cwe-tou. The CWE data itself carries MITRE's terms of use; permissive for code but you must respect MITRE's CWE usage terms when distributing or relying on the weakness data.
Quickstart
pip install cwe2
from cwe2.database import Database
db = Database()
weakness = db.get(15)
print(weakness.description)
Verify before relying
- Whether the vendored CWE data is kept current with MITRE's official CWE updates, given the dormant maintenance status.
- Performance characteristics when querying large numbers of weaknesses or iterating the full database.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packageimportlib-resources |
| Maintenance | Dormant 751 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 78,876 / month, #14,400 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyTopic :: Software DevelopmentTopic :: Utilities |
Evidence: cwe2-3.0.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “CWE lookup library”
- cwe2cwe2 provides programmatic access to the Common Weakness Enumeration…
- libsastlibsast is a static application security testing library that scans…
- geoip2fastGeoIP2Fast performs fast geolocation lookups for IPv4 and IPv6…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also nvdlib · cpe · flawfinder · safety · debsecan-mcp · pip-audit · csaf-tool · amulet-leveldb · cloudsec-audit · spake2