Skip to content

fb-idb 1.1.7 PyPI package: ImportError in companion_spawner due to missing IDB_LOCAL_TARGETS_FILE constant #902

Description

@carlgieringer

Summary

The fb-idb 1.1.7 package on PyPI ships idb/common/companion_spawner.py which imports IDB_LOCAL_TARGETS_FILE from idb/common/constants.py. However, constants.py in the same package does not define this constant, causing an ImportError at module load time. This completely breaks idb's ability to auto-start idb_companion daemons for simulators.

Steps to Reproduce

pip install fb-idb==1.1.7
python3 -c "from idb.common.companion_spawner import CompanionSpawner"

Result:

ImportError: cannot import name 'IDB_LOCAL_TARGETS_FILE' from 'idb.common.constants'

Expected: Module loads successfully.

In practice, this means any idb command that needs to auto-start a companion (e.g., idb ui describe-all --udid <UDID>) fails with:

Failed to connect to companion at address DomainSocketAddress(path='/tmp/idb/<UDID>_companion.sock'): [Errno 2] No such file or directory

Root Cause

The repo and PyPI package are out of sync:

  1. Aug 2021companion_spawner.py was removed from the repo (277a197a "Flatten CompanionSpawner into Companion")
  2. Sept 2021IDB_LOCAL_TARGETS_FILE was removed from constants.py (a4159c8e "Remove dependence on local state file")
  3. March 2022fb-idb 1.1.7 was published to PyPI — this is the latest release

The repo changes are internally consistent (both the file and the constant were removed together), but the PyPI package appears to have been built from a state where constants.py was updated but companion_spawner.py was not yet removed.

Workaround

We patch constants.py after installing fb-idb to add the missing constant:

IDB_CONSTANTS=".venv/lib/python3.12/site-packages/idb/common/constants.py"
if [ -f "$IDB_CONSTANTS" ] && ! grep -q 'IDB_LOCAL_TARGETS_FILE' "$IDB_CONSTANTS"; then
    echo 'IDB_LOCAL_TARGETS_FILE: str = f"{BASE_IDB_FILE_PATH}/local_targets"' >> "$IDB_CONSTANTS"
fi

Suggested Fix

Publish a new PyPI release from the current repo state. The repo code is consistent — companion_spawner.py no longer exists and constants.py no longer references IDB_LOCAL_TARGETS_FILE. A fresh build from main would resolve this for all users.

The release process is straightforward — setup.py just needs FB_IDB_VERSION set:

FB_IDB_VERSION=1.1.8 python setup.py sdist bdist_wheel
twine upload dist/*

This was also raised in #858 ("Are there any plans to release a new version?").

Environment

  • macOS 26.2 (Apple Silicon)
  • Python 3.12
  • fb-idb 1.1.7 (latest on PyPI)
  • idb-companion 1.1.8 (Homebrew)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions