Skip to content

Populate empty __init__.py files with __all__ exports across modules #2315

@Vasilije1990

Description

@Vasilije1990

Problem / Background

20+ __init__.py files across the codebase are completely empty. This means:

  • IDEs cannot provide accurate autocomplete for these packages
  • from cognee.modules import * imports nothing
  • The public API surface is implicit rather than explicit
  • Static analysis tools cannot verify import correctness

Affected files (partial list):

  • cognee/modules/__init__.py
  • cognee/modules/visualization/__init__.py
  • cognee/modules/ontology/__init__.py
  • cognee/modules/cognify/__init__.py
  • cognee/modules/retrieval/__init__.py
  • cognee/modules/data/__init__.py
  • cognee/api/__init__.py
  • cognee/api/v1/__init__.py
  • cognee/tasks/graph/cascade_extract/__init__.py
  • And 10+ more in cognee/eval_framework/

Goal

Add meaningful __all__ exports to empty __init__.py files so each package explicitly declares its public API.

Proposed Solution

For each empty __init__.py, identify the key symbols that should be importable from that package and add them:

# cognee/modules/chunking/__init__.py
from .TextChunker import TextChunker
from .LangchainChunker import LangchainChunker

__all__ = ["TextChunker", "LangchainChunker"]

Note: Not all __init__.py files need exports — some are legitimately namespace-only packages. Focus on modules where users/developers would reasonably do from cognee.modules.X import Y.

Acceptance Criteria

  • At least 10 of the most important empty __init__.py files are populated
  • Each populated file has an __all__ list
  • Imports are validated (no circular import issues introduced)
  • ruff check . passes
  • Existing imports throughout the codebase still work

Dependencies / Blockers

None. This can be done incrementally — one module at a time.

Relevant Links / Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions