Skip to content

Rework addon system with composable core module and AST-based addon application#92

Merged
renardeinside merged 11 commits intomainfrom
rework/addon-system
Feb 19, 2026
Merged

Rework addon system with composable core module and AST-based addon application#92
renardeinside merged 11 commits intomainfrom
rework/addon-system

Conversation

@renardeinside
Copy link
Copy Markdown
Collaborator

Summary

Implements #77 — a comprehensive rework of the addon/template system:

  • Modular core/ package: Split monolithic core.py into core/ with config.py, factory.py, dependencies.py, headers.py, resources.py, static.py — addons no longer need to replace the entire file
  • Python AST editing in Rust (py_edit): New module using ruff_python_parser for surgical code modifications — add_import(), add_class_member(), add_call_keyword() with 16 unit tests
  • Composable backend addons: BackendAddonSpec + PythonEdit enum for declarative addon definitions that apply via AST edits instead of file overlay
  • Rename stateful → lakebase: Restructured as composable addon with lakebase_lifespan and Dependencies.Session
  • New mock addons: sql, serving-endpoint, genie — stub addons with dependency injection
  • Backend-only template: Minimal template skips frontend entirely — no Vite, no bun, no [tool.apx.ui]
  • Backend-only dev server: Optional frontend port, conditional UI router/health check, skip OpenAPI/bun in preflight
  • New structured types: DatabricksAppsHeaders model, DatabricksResourcesConfig with env prefix
  • Composable lifespans: create_app(lifespans=[...]) with _chain_lifespans() for stacking multiple backend addons

Test plan

  • cargo check passes
  • All 206 tests pass (0 failures)
  • apx init with Minimal template creates backend-only project
  • apx init with Essential template creates full-stack project
  • apx dev start on backend-only project starts only backend
  • apx dev apply lakebase applies addon via AST edits

🤖 Generated with Claude Code

renardeinside and others added 11 commits February 18, 2026 20:48
…uter

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ve stale addons

- Simplify _base.py: drop Generic[T], abstract get_instance, as_depends
- Fix _defaults.py: use @staticmethod, fix ConfigDependency Depends() target
- Fix SQL addon: remove double-wrapping, update addon.toml to match exports
- Extract apply_python_edits from apply_backend_addon for reuse in init
- Fix init to apply Python AST edits (imports + Dependencies aliases) from addon manifests
- Remove genie, lakebase, serving-endpoint addons (use old Dependency API)
- Add tests verifying Dependencies class gets Sql member after addon apply

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@renardeinside renardeinside merged commit 8887fc7 into main Feb 19, 2026
3 checks passed
@renardeinside renardeinside deleted the rework/addon-system branch February 19, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant