Skip to content

v0.2.0: The Polymorphic Update

Choose a tag to compare

@JacksonFergusonDev JacksonFergusonDev released this 28 Feb 04:21
· 763 commits to main since this release

Summary

This release transitions the Protostar CLI from a procedural, flat-argument script into a fully decoupled, polymorphic architecture. We’ve enforced a strict "manifest-first, side-effects-last" design philosophy. The execution phase is now entirely declarative, preventing I/O side-effects from mutating the global state before the orchestrator is ready to build.

Less time fighting boilerplate, more time actually running the data analysis pipelines.

🚀 Major Highlights

Core Architecture: O(1) Dispatch & Declarative State

We’ve completely rewritten the internal dependency injection and routing mechanisms.

  • Modular Subcommands: argparse namespace saturation is gone. We've moved to a standard git-style subcommand architecture (proto init, proto generate).
  • TargetGenerator ABC: Imperative scaffolding functions have been modularized into the generators/ package. The orchestrator now uses an O(1) dynamic dictionary dispatch to evaluate targets rather than rigid if/elif blocks.
  • Manifest State Separation: The overloaded ignored_paths attribute in EnvironmentManifest is dead. It’s been split into vcs_ignores (for .gitignore) and workspace_hides (for IDE visualization), stopping version control and IDE settings from clobbering each other.
  • Cascading Configs: Added an immutable merge cascade for workspace-specific .protostar.toml overrides. You can now override global presets locally without destroying unmentioned keys.

Domain-Specific Pipeline Presets

We've migrated the rigid --scientific flag out of the cli.py monkey-patch and into a dedicated PresetModule registry, bringing three new specialized environments with it:

  • --astro: Built for observational and theoretical pipelines. Drops in astropy and gwpy, and scaffolds data/fits/ structures. It's perfectly tuned for crunching final-year thesis data at UVic without having to reinvent the directory wheel.
  • --dsp: Scaffolds audio analysis and signal processing pipelines (librosa, mido, data/raw_audio). Ideal for dissecting frequencies when building out mixing tools for the next DnB or garage set.
  • --embedded: Preps host-side hardware telemetry (pyserial, esptool).
  • --scientific: Now automatically generates a standard analytical tree (data/, notebooks/, src/) and aggressively .gitignores massive binary formats (*.csv, *.parquet, *.nc).

The Generator Engine (proto generate)

The new generate subcommand handles domain-specific boilerplate independently of the global orchestrator lifecycle, ensuring CLI atomicity.

  • Hardware & IoT (circuitpython, pio): PlatformIO targets now infer architecture strings natively. The CircuitPython generator drops a non-blocking time.monotonic() state machine by default. This avoids standard time.sleep() bottlenecks when soldering up sensors or custom event lighting rigs.
  • C++ (cmake, cpp-class): The cmake generator statically scans the local directory via Python to write .cpp filenames directly into the add_executable directive, officially bypassing the CMake globbing cache anti-pattern.
  • LaTeX (tex): Generates modular .tex templates with dynamically cascading preambles (science macros, biblatex) based on your active preset.

🔧 The Fine Print (QoL, Tooling, & Chores)

  • Rich TUI & Help System: Replaced the ugly argparse text wrap with a responsive rich.table.Table TUI. Executing proto help generate now dynamically reads registry docstrings and prints a clean, rounded-box grid that respects terminal width.
  • POSIX pip Fallback: Added a python_package_manager config option. If uv isn't available, Protostar falls back to standard POSIX pip, dynamically generating .venv and requirements.txt states.
  • Docker Context Optimization: The new --docker flag dynamically merges your manifest's vcs_ignores with standard daemon context bloat to generate an optimized .dockerignore.
  • POSIX Short Flags: Added single-character shorthands (-p for --python, -r for --rust) for better terminal ergonomics.
  • Global XDG Config: proto config automatically resolves ~/.config/protostar/config.toml and spawns a subprocess to open it in $EDITOR.
  • Strict Typing & Linting: Enforced Google-style docstrings across the codebase via ruff's D ruleset and added explicit return types to squash all mypy violations.
  • Documentation: Shipped a formal CONTRIBUTING.md enforcing the sandboxed disk I/O testing mandates.