Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 2.39 KB

AGENTS.md

File metadata and controls

31 lines (23 loc) · 2.39 KB

AGENTS.md — UnifyPy Engineering Guidelines

UnifyPy is a configuration-driven, cross-platform Python application packaging orchestrator (PyInstaller + native Windows/macOS/Linux installers).

Architecture Overview

  • unifypy/__main__.py & unifypy/cli/: CLI argument parsing and --init interactive configuration wizard.
  • unifypy/core/: Lifecycle Engine, fail-fast EventBus, BuildContext, layered ConfigManager, format resolution, and platform/arch normalization.
  • unifypy/plugins/: Lifecycle stage plugins subscribed to EventBus by explicit priority.
  • unifypy/pyinstaller/: PyInstaller option tables, .spec pure renderer (spec_renderer.py), and PyInstallerConfigBuilder.
  • unifypy/platforms/: BasePackager + PackagerRegistry + OS packagers (windows/: Inno Setup EXE & WiX MSI; macos/: DMG & post-processing; linux/: shared common.py + DEB, RPM, AppImage).
  • unifypy/utils/: Shared paths.py, ProgressManager (TTY rolling tail + GitHub Actions ::group::), streaming SilentRunner, single-probe ToolManager, CacheManager, RollbackManager, and IconConverter.

Coding Standards

  1. Self-Explanatory Naming: Distinguish config_manager (ConfigManager), build_config (merged dict), macos_config (platform dict), and dmg_options / inno_options (installer dict).
  2. Single Responsibility & Shared Base: Keep rendering functions pure; put cross-module path/asset helpers in unifypy/utils/paths.py and shared Linux staging in unifypy/platforms/linux/common.py.
  3. Unified Output: Never embed decorative emojis or manual indentation in plugin/packager strings. Route all user-facing progress, commands, warnings, and errors through ProgressManager (or unifypy.core.logutil in library helpers).
  4. Flat & Explicit Control Flow: Use guard clauses (max 2–3 indentation levels). Catch specific exceptions (OSError, ValueError, subprocess.SubprocessError) at clear boundaries instead of silent except Exception: pass.
  5. Security Invariants:
    • SilentRunner.run_command must default to shell=False.
    • Auto-downloaded binaries must verify pinned SHA256 hashes; zip extraction must reject path traversal (Zip Slip); Inno Setup is never silent-installed.
    • macOS entitlements default to production unless --development is passed.

Verification

Run the unit test suite before committing:

python3 -m pytest tests/ -q