Skip to content

chore: clean up import hygiene in src/agentics/core#166

Open
mnlscn wants to merge 1 commit into
IBM:mainfrom
mnlscn:chore/import-hygiene
Open

chore: clean up import hygiene in src/agentics/core#166
mnlscn wants to merge 1 commit into
IBM:mainfrom
mnlscn:chore/import-hygiene

Conversation

@mnlscn
Copy link
Copy Markdown
Contributor

@mnlscn mnlscn commented Jun 1, 2026

chore: clean up import hygiene across src/agentics/core

Summary

  • Removes 16 unused imports (F401) across the core package — dead symbols left over from commented-out code, refactors, and copy-paste
  • Removes 6 duplicate/redefined imports (F811) — symbols imported more than once at module level
  • Hoists 28 mid-file imports (E402) to the top of their respective modules — most were scattered inside function blocks or after load_dotenv() calls with no technical reason to be deferred
  • Adds __all__ = ["AG"] to core/__init__.py to make the AG re-export explicit

Files changed

File What changed
core/__init__.py Added __all__ = ["AG"] to mark AG as an intentional re-export
core/agentics.py Removed unused Callable (typing) and PydanticTransducerVLLM (superseded)
core/default_types.py Removed unused asdict, is_dataclass, Any, Generic, create_model
core/mellea_pydantic_transducer.py Removed unused asyncio, Optional, RejectionSamplingStrategy; hoisted tqdm/mellea/pydantic imports while preserving load order (tqdm must be patched before mellea loads)
core/semantic_operators.py Removed unused pathlib and Field
core/transducible_functions.py Hoisted 9 mid-file stdlib/pydantic/agentics imports to the top block; consolidated two separate utils imports into one
core/utils.py Hoisted 10 mid-file imports (math, json, jsonfinder, ast, textwrap, types, hashlib, etc.) to the top; removed unused numerize and duplicate create_model
core/vector_store.py Removed redundant mid-file re-import of BaseModel, ConfigDict, Any, Dict, List (already at top)

Notes

  • mellea_pydantic_transducer.py: import order for tqdm / mellea is intentionally kept below
    os.environ["TQDM_DISABLE"] = "1" and the tqdm.tqdm = no_bar patch.
    These imports carry # noqa: E402 with an explanatory comment — this is a genuine load-order constraint, not a circular import.

  • No functional changes — only import structure.

Signed-off-by: Manuel Scionti <scionti.manuel@hotmail.it>
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