Skip to content

civic-interconnect/civic-transparency-py-cwe-types

Repository files navigation

Civic Transparency CWE Types

Docs PyPI Python 3.12+ CI Status License: MIT security: bandit

Immutable, typed result objects for CWE, Standards, and Schema workflows.

Provides strongly-typed Python models for Common Weakness Enumeration (CWE) analysis, standards framework mappings, and schema validation workflows.

Features

  • Zero Dependencies - Pure Python with no external requirements
  • Immutable Design - Functional-style helpers return new instances
  • Type Safety - Full static typing with py.typed marker
  • Composable - Small building blocks for complex workflows
  • Memory Efficient - Frozen dataclasses for better performance

Installation

pip install civic-transparency-py-cwe-types

Requirements: Python 3.12+

Quick Start

from ci.transparency.cwe.types.cwe.results import CweLoadingResult, add_cwe

# Create immutable result objects
result = CweLoadingResult()
result = add_cwe(result, "CWE-79", {
    "id": "CWE-79",
    "name": "Cross-site Scripting",
    "category": "injection"
})

print(f"Loaded CWEs: {result.cwe_count}")
print(f"Has errors: {result.messages.has_errors}")

What's Included

Domain Purpose Key Results
CWE Load, validate, analyze CWE data CweLoadingResult, CweValidationResult, CweRelationshipResult
Standards Framework loading & CWE mappings StandardsLoadingResult, StandardsMappingResult
Schema Generic schema operations SchemaLoadingResult, SchemaValidationResult
CWE Schema Domain-specific CWE schema validation CweSchemaLoadingResult, CweSchemaValidationResult

Documentation

Development

git clone https://github.com/civic-interconnect/civic-transparency-py-cwe-types
cd civic-transparency-py-cwe-types
uv venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
uv sync --extra dev --extra docs

Run tests:

uv run pytest
uv run pyright src/

Versioning

This specification follows semantic versioning. See CHANGELOG.md for version history.

License

MIT © Civic Interconnect

About

Python types for the CWE Catalog transparency ecosystem

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors