Skip to content

Integration.load() default path resolution only works with vendored dependencies #16

@TheRealAgentK

Description

@TheRealAgentK

Problem

Integration.load() without a config_path argument uses a hardcoded 3-level-up path resolution from the SDK's own integration.py:

# src/autohive_integrations_sdk/integration.py
if config_path is None:
    config_path = os.path.join(
        os.path.dirname(os.path.dirname(os.path.dirname(__file__))),
        'config.json'
    )

This only resolves to the integration's config.json when the SDK is vendored via pip install -r requirements.txt --target dependencies, placing the SDK at dependencies/autohive_integrations_sdk/integration.py (3 levels up = integration root).

With a standard pip install into a venv, the SDK lands in .venv/lib/python3.13/site-packages/autohive_integrations_sdk/integration.py, and 3 levels up resolves to .venv/lib/ — not the integration root. This raises a ConfigurationError.

Current workarounds

  • Vendored install: pip install -r requirements.txt --target dependencies — works but is a legacy pattern we're moving away from.
  • Explicit path: Integration.load(os.path.join(os.path.dirname(__file__), "config.json")) — works everywhere but triggers an advisory warning in CI tooling, which checks for the literal string Integration.load().

Impact

  • The samples/template/ README tells users to run pip install -r requirements.txt (no --target), but the template code uses Integration.load() (no args). These are incompatible.
  • Documentation recommends Integration.load() for single-file integrations, but this silently depends on the vendored install pattern.
  • Multi-file integrations already use explicit config_path, so they're unaffected.

Suggested fix

Update the default path resolution to locate config.json relative to the calling module (e.g., using inspect.stack() or requiring the caller to pass __file__), rather than relative to the SDK's own source file. This would make Integration.load() work regardless of how the SDK is installed.

Discovered during the documentation unification audit (see integrations-sdk#13, integrations-sdk#15).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions