Skip to content

fix: add missing __init__.py to Python template subpackages#336

Open
notgitika wants to merge 3 commits intomainfrom
fix/missing-init-py
Open

fix: add missing __init__.py to Python template subpackages#336
notgitika wants to merge 3 commits intomainfrom
fix/missing-init-py

Conversation

@notgitika
Copy link
Contributor

Description

Add empty init.py to model/ and mcp_client/ directories across all 6 Python framework templates, ensuring imports work correctly regardless of working directory or packaging method.

  • Strands (model + mcp_client)
  • LangChain/LangGraph (model + mcp_client)
  • CrewAI (model only — no mcp_client dir)
  • Google ADK (model + mcp_client)
  • OpenAI Agents (model + mcp_client)
  • AutoGen (model + mcp_client)

Related Issue

Closes #335

Documentation PR

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

How have you tested the change?

  • I ran npm run test:unit and npm run test:integ
  • I ran npm run typecheck
  • I ran npm run lint
  • If I modified src/assets/, I ran npm run test:update-snapshots and committed the updated snapshots

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.

@notgitika notgitika requested a review from a team February 18, 2026 02:21
@github-actions
Copy link
Contributor

github-actions bot commented Feb 18, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 41.28% 2657 / 6435
🔵 Statements 40.74% 2786 / 6838
🔵 Functions 43.52% 571 / 1312
🔵 Branches 46.81% 1765 / 3770
Generated in workflow #426 for commit 498fabd by the Vitest Coverage Report Action

@aidandaly24
Copy link
Contributor

/strands review this PR and make sure that we are not missing anything. Don't make any changes. Look to see if we are missing these things anywhere else.

@aidandaly24
Copy link
Contributor

I think we are also missing __init__.py in one other subpackage. The src/assets/python/strands/capabilities/memory/ has no __init__.py. This directory contains session.py, and the strands main.py template imports it as:

from memory.session import get_memory_session_manager

@github-actions
Copy link
Contributor

PR Review: Missing __init__.py Files

I've completed a comprehensive review of this PR to identify any gaps in coverage.

✅ What This PR Successfully Addresses

The PR correctly adds __init__.py files to 11 directories across all 6 Python framework templates:

  • AutoGen: model/ + mcp_client/
  • CrewAI: model/ (no mcp_client directory)
  • Google ADK: model/ + mcp_client/
  • LangChain/LangGraph: model/ + mcp_client/
  • OpenAI Agents: model/ + mcp_client/
  • Strands: model/ + mcp_client/

❌ Critical Gap Found

Missing: src/assets/python/strands/capabilities/memory/__init__.py

Why This Matters

  1. Template Rendering Logic: The BaseRenderer.ts (lines 55-59) copies the capabilities/memory/ directory to memory/ in the project root when hasMemory=true

  2. Import Dependency: The strands/base/main.py (line 6) contains:

    from memory.session import get_memory_session_manager
  3. Impact: Without __init__.py, the memory functionality will fail with ImportError for any Strands project that enables memory capabilities.

Evidence

  • The snapshot test shows python/strands/capabilities/memory/session.py exists
  • The snapshot test does NOT show python/strands/capabilities/memory/__init__.py
  • Only Strands has this capabilities directory structure - other frameworks don't need it

Recommendation

Add an empty __init__.py file to src/assets/python/strands/capabilities/memory/ to complete this fix.

Additional Verification

I verified that:

  • All other frameworks (AutoGen, CrewAI, Google ADK, LangChain/LangGraph, OpenAI Agents) are complete ✅
  • No other Python directories in the templates need __init__.py files ✅
  • This is the only missing file ✅

@notgitika
Copy link
Contributor Author

I think we are also missing __init__.py in one other subpackage. The src/assets/python/strands/capabilities/memory/ has no __init__.py. This directory contains session.py, and the strands main.py template imports it as:

from memory.session import get_memory_session_manager

Thanks for catching this @aidandaly24 I addressed this in the following commit.

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.

Missing __init__.py in Python template subpackages breaks imports

2 participants

Comments