Skip to content

Test integrations with empty shadow modules #5140

@alexander-alderman-webb

Description

Background

Two critical bugs came in that would have been hard to catch with human review (#5134, #5129). Both occurred at initialization time due to ModuleNotFoundError as we moved some integrations to the auto-activating list in #5111.

Many imports are short and therefore easy to be shadowed by local files. For example, a user ran the openai-agents with a local agents.py file. Normally, auto-enabling integrations are not activated when the associated package is not installed, because the imports are gated. In this case, we had

try:
    import agents

except ImportError:
    raise DidNotEnable("OpenAI Agents not installed")

Because no members of the agents package were imported, the import did not raise an error, in spite of agents referring to agents.py instead of openai-agents in the user's environment.

Solution

Run a "smoke test" that sets the corresponding package to be empty and initializes the SDK.

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions