Files
markitect-main/markitect/packaging/base.py
tegwick ec09fdd0bd
Some checks failed
Test Suite / unit-tests (3.11) (push) Has been cancelled
Test Suite / unit-tests (3.12) (push) Has been cancelled
Test Suite / integration-tests (push) Has been cancelled
Test Suite / e2e-tests (push) Has been cancelled
Test Suite / performance-tests (push) Has been cancelled
Test Suite / code-quality (push) Has been cancelled
Test Suite / security-scan (push) Has been cancelled
Test Suite / test-summary (push) Has been cancelled
feat: complete Issue #150 - Advanced Packaging Features (.mdz, .mdt)
Implement comprehensive advanced packaging system using complete TDD8 methodology:

## Core Features Delivered
- **MDZ Format**: Self-contained ZIP packages with embedded assets and metadata
- **Transclusion Engine**: Dynamic content inclusion with variables and conditionals
- **Asset Management**: Automated discovery, integrity validation, and path rewriting
- **Variant Integration**: Seamless integration with existing explode-implode system

## Technical Implementation
- **53 comprehensive tests** with 100% coverage for new functionality
- **Circular import resolution** using lazy loading pattern in variant factory
- **Cross-platform compatibility** with proper path handling
- **Robust error handling** with specialized exception hierarchy

## Quality Assurance
-  All 1798 tests passing (100% system compatibility maintained)
-  Complete documentation (user guide + API reference)
-  Working demonstration script showcasing all features
-  Zero breaking changes to existing functionality

## Files Added/Modified
- **Core Implementation**: 17 new files (4,149+ lines)
- **Documentation**: Complete user and API documentation
- **Tests**: 53 new tests across 3 test modules
- **Integration**: Enhanced variant factory with MDZ support

Built on solid foundation from Issues #148-149. Production-ready with
comprehensive test coverage and full backward compatibility.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-13 23:09:18 +02:00

53 lines
1.5 KiB
Python

"""
Base packaging variant infrastructure.
Provides the abstract base class for packaging variants and
core packaging functionality that extends the existing variant system.
"""
from abc import abstractmethod
from pathlib import Path
from typing import Dict, List, Any
from ..explode_variants.base_variant import BaseVariant
from .metadata import PackageMetadata, AssetMetadata
class PackageFormat:
"""Package format constants."""
MDZ = "mdz"
MDT = "mdt"
class PackagingVariant(BaseVariant):
"""
Abstract base class for packaging variants.
Extends BaseVariant to support packaging-specific operations
like asset embedding, path rewriting, and metadata management.
"""
@abstractmethod
def create_package(self, source_path: Path, options: Dict[str, Any]) -> Dict[str, Any]:
"""Create a package from source content."""
pass
@abstractmethod
def extract_package(self, package_path: Path, options: Dict[str, Any]) -> Dict[str, Any]:
"""Extract a package to destination."""
pass
@abstractmethod
def get_package_metadata(self, package_path: Path) -> PackageMetadata:
"""Get metadata from a package."""
pass
@abstractmethod
def embed_assets(self, assets: List[Path], package_path: Path) -> List[AssetMetadata]:
"""Embed assets into the package."""
pass
@abstractmethod
def rewrite_asset_paths(self, content: str, asset_map: Dict[str, str]) -> str:
"""Rewrite asset paths in content."""
pass