Feature ID: F-001 Priority: P0 Phase: Phase 1 (0.20.0-alpha.1) Tech Design Reference: Section 4.2
Remove all self-built protocol layers, CLI, and extensions that are superseded by the apcore ecosystem or out of scope for v2. Reduces the codebase from ~48,500 lines to ~31,000 lines and eliminates 13 third-party dependency groups.
src/apflow/api/ # Entire directory (a2a, mcp, graphql, docs, main.py)
src/apflow/cli/ # Entire directory (18 files)
src/apflow/extensions/crewai/ # Entire directory (4 files)
src/apflow/extensions/llm/ # Entire directory (2 files)
src/apflow/extensions/generate/ # Entire directory (8 files)
src/apflow/extensions/grpc/ # Entire directory (2 files)
src/apflow/extensions/tools/ # Entire directory (3 files)
tests/api/ # All API tests
tests/cli/ # All CLI tests
tests/extensions/crewai/ # All CrewAI tests
tests/extensions/llm/ # All LLM tests
tests/extensions/generate/ # All generate tests
tests/extensions/grpc/ # All gRPC tests
tests/extensions/tools/ # All tools tests
pyproject.toml
Step-by-step changes:
- Update
versionfrom"0.18.2"to"0.20.0". - Update
descriptionto"AI-Perceivable Distributed Orchestration". - Update
requires-pythonfrom">=3.10"to">=3.11". - Remove from
classifiers:"Programming Language :: Python :: 3.10". - In
dependencies, remove:"duckdb-engine>=0.10.0","pytz>=2024.1". - In
dependencies, add:"apcore>=0.14.0". - Delete these
[project.optional-dependencies]sections entirely:a2a(a2a-sdk, fastapi, uvicorn, starlette, websockets, httpx, aiohttp, python-jose)cli(click, rich, typer, python-dotenv, nest_asyncio, httpx, PyJWT, pyyaml)crewai(crewai, litellm, anthropic, aiodns)llm(litellm)grpc(grpclib, protobuf)graphql(strawberry-graphql, fastapi, starlette, uvicorn)tools(requests, beautifulsoup4, trafilatura, brotli, bs4)llm-key-config(empty)mcp(empty, comments only)standard(meta extra referencing deleted extras)all(meta extra referencing deleted extras)
- Add
apcore-mcp>=0.11.0,apcore-a2a>=0.3.0,apcore-cli>=0.3.0to coredependencies(not optional — MCP, A2A, CLI are standard features of apflow). - In
dev, remove:"apdev[dev]>=0.1.6","jsonfinder>=0.4.0","memory-profiler>=0.61.0","psutil>=5.9.0". - Delete
[project.scripts]section entirely (removesapflowandapflow-serverentry points). - Update
[tool.black]target-versionto['py311', 'py312']. - Update
[tool.ruff]target-versionto"py311". - Update
[tool.mypy]python_versionto"3.11".
src/apflow/__init__.py
- Update
__version__to"0.20.0". - Update module docstring:
""" apflow - AI-Perceivable Distributed Orchestration A distributed task orchestration engine where every capability is AI-perceivable via the apcore module standard. Core modules (always included): - core.interfaces: Core interfaces (ExecutableTask, BaseTask) - core.execution: Task orchestration (TaskManager, StreamingCallbacks) - core.extensions: Unified extension system (ExtensionRegistry) - core.storage: Database session factory (SQLite default, PostgreSQL optional) - bridge: apcore Module registration - durability: Checkpoint/resume, retry, circuit breaker - governance: Token budget, cost policy, usage reporting """
- Remove deprecated backward-compatibility exports from
__all__:"create_storage","get_default_storage". - Remove the lazy import branch for
create_storageandget_default_storagein__getattr__.
After deletion, search for and fix any remaining references to deleted modules:
Search pattern: from apflow.extensions.crewai
- Location:
src/apflow/core/execution/task_executor.py(lazy import for CrewAI executor type detection) - Action: Remove the lazy import block. The executor registry handles type resolution; no special-casing needed.
Search pattern: from apflow.api
- Location: Possibly in
src/apflow/__init__.pyor test conftest files - Action: Remove any references found.
Search pattern: from apflow.cli
- Location: Possibly in test conftest files
- Action: Remove any references found.
Search pattern: crewai in pyproject.toml
- Action: Ensure no remaining references in extras or dependency lists.
Search pattern: duckdb anywhere in src/
- Action: Remove references in storage code (handled by storage-migration.md), documentation comments, and any config defaults.
No new methods. This feature is purely subtractive.
No data model changes.
Before any deletions, run the full test suite and record:
- Total test count
- Pass count
- Failure count
- Test duration
After all deletions:
def test_preserved_imports():
"""All preserved public imports still work."""
from apflow import ExecutableTask, BaseTask, TaskManager
from apflow import StreamingCallbacks, create_session
from apflow import executor_register, storage_register, hook_register
from apflow.core.execution.task_creator import TaskCreator
from apflow.core.storage.sqlalchemy.task_repository import TaskRepository
from apflow.core.extensions.scanner import ExtensionScanner
def test_deleted_imports_fail():
"""Deleted module imports raise ImportError."""
with pytest.raises(ImportError):
from apflow.api.a2a import agent
with pytest.raises(ImportError):
from apflow.cli.main import main
with pytest.raises(ImportError):
from apflow.extensions.crewai import CrewaiExecutor
with pytest.raises(ImportError):
from apflow.extensions.generate import GenerateExecutor
with pytest.raises(ImportError):
from apflow.extensions.grpc import GrpcExecutor
def test_pip_install_succeeds():
"""pip install apflow succeeds with only core + apcore deps."""
# Verify via subprocess: pip install . --dry-run
# Check no duckdb-engine, no crewai, no fastapi in resolved deps
def test_remaining_tests_pass():
"""All preserved test files pass."""
# Run: pytest tests/ --ignore=tests/api --ignore=tests/cli ...
# Verify exit code 0- All listed directories are deleted from the source tree.
pyproject.tomlhas no references to deleted modules or their dependencies.pip install apflowsucceeds with only core + apcore dependencies.pip install apflowdoes not install: duckdb-engine, crewai, litellm, fastapi, uvicorn, click, rich, typer, strawberry-graphql, grpclib, protobuf, beautifulsoup4, trafilatura.- Remaining test suite passes (tests for deleted modules are also removed).
- No
from apflow.api,from apflow.cli,from apflow.extensions.crewai,from apflow.extensions.llm,from apflow.extensions.generate,from apflow.extensions.grpc, orfrom apflow.extensions.toolsimports exist in preserved source code. __version__is"0.20.0".project.scriptssection is removed.