Current behavior
hamilton ui fails with ImportError: cannot import name 'API_KEY' from 'hamilton.telemetry'
Stack Traces
╭────────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ───────────────────────────────────────────────────────────────────────────╮
│ /home/amitchell/trials/hamilton-data-pipelines/.venv/lib/python3.12/site-packages/hamilton/cli/__main__.py:316 in ui │
│ │
│ 313 │ │ ) │
│ 314 │ │ raise typer.Exit(code=1) from e │
│ 315 │ │
│ ❱ 316 │ ctx.invoke( │
│ 317 │ │ commands.run, │
│ 318 │ │ port=port, │
│ 319 │ │ base_dir=base_dir, │
│ │
│ /home/amitchell/trials/hamilton-data-pipelines/.venv/lib/python3.12/site-packages/typer/_click/core.py:489 in invoke │
│ │
│ /home/amitchell/trials/hamilton-data-pipelines/.venv/lib/python3.12/site-packages/hamilton_ui/commands.py:131 in run │
│ │
│ 128 │ │ with set_env_variables(env): │
│ 129 │ │ │ settings_file_param = f"--settings={settings_file.value}" │
│ 130 │ │ │ if not no_migration: │
│ ❱ 131 │ │ │ │ execute_from_command_line(["manage.py", "migrate", settings_file_param]) │
│ 132 │ │ │ execute_from_command_line( │
│ 133 │ │ │ │ # Why insecure? Because we're running locally using django's server which │
│ 134 │ │ │ │ # is not specifically meant for production. That said, we'll be fixing this up shortly, │
│ │
│ /home/amitchell/trials/hamilton-data-pipelines/.venv/lib/python3.12/site-packages/django/core/management/__init__.py:443 in execute_from_command_line │
│ │
│ 440 def execute_from_command_line(argv=None): │
│ 441 │ """Run a ManagementUtility.""" │
│ 442 │ utility = ManagementUtility(argv) │
│ ❱ 443 │ utility.execute() │
│ 444 │
│ │
│ /home/amitchell/trials/hamilton-data-pipelines/.venv/lib/python3.12/site-packages/django/core/management/__init__.py:417 in execute │
│ │
│ 414 │ │ │ │
│ 415 │ │ │ # In all other cases, django.setup() is required to succeed. │
│ 416 │ │ │ else: │
│ ❱ 417 │ │ │ │ django.setup() │
│ 418 │ │ │
│ 419 │ │ self.autocomplete() │
│ 420 │
│ │
│ /home/amitchell/trials/hamilton-data-pipelines/.venv/lib/python3.12/site-packages/django/__init__.py:24 in setup │
│ │
│ 21 │ │ set_script_prefix( │
│ 22 │ │ │ "/" if settings.FORCE_SCRIPT_NAME is None else settings.FORCE_SCRIPT_NAME │
│ 23 │ │ ) │
│ ❱ 24 │ apps.populate(settings.INSTALLED_APPS) │
│ 25 │
│ │
│ /home/amitchell/trials/hamilton-data-pipelines/.venv/lib/python3.12/site-packages/django/apps/registry.py:91 in populate │
│ │
│ 88 │ │ │ │ if isinstance(entry, AppConfig): │
│ 89 │ │ │ │ │ app_config = entry │
│ 90 │ │ │ │ else: │
│ ❱ 91 │ │ │ │ │ app_config = AppConfig.create(entry) │
│ 92 │ │ │ │ if app_config.label in self.app_configs: │
│ 93 │ │ │ │ │ raise ImproperlyConfigured( │
│ 94 │ │ │ │ │ │ "Application labels aren't unique, " │
│ │
│ /home/amitchell/trials/hamilton-data-pipelines/.venv/lib/python3.12/site-packages/django/apps/config.py:178 in create │
│ │
│ 175 │ │ │ │ # message for typos in INSTALLED_APPS. │
│ 176 │ │ │ │ # This may raise ImportError, which is the best exception │
│ 177 │ │ │ │ # possible if the module at mod_path cannot be imported. │
│ ❱ 178 │ │ │ │ mod = import_module(mod_path) │
│ 179 │ │ │ │ candidates = [ │
│ 180 │ │ │ │ │ repr(name) │
│ 181 │ │ │ │ │ for name, candidate in inspect.getmembers(mod, inspect.isclass) │
│ │
│ /home/amitchell/.local/share/uv/python/cpython-3.12.13-linux-x86_64-gnu/lib/python3.12/importlib/__init__.py:90 in import_module │
│ │
│ 87 │ │ │ if character != '.': │
│ 88 │ │ │ │ break │
│ 89 │ │ │ level += 1 │
│ ❱ 90 │ return _bootstrap._gcd_import(name[level:], package, level) │
│ 91 │
│ 92 │
│ 93 _RELOADING = {} │
│ in _gcd_import:1387 │
│ in _find_and_load:1360 │
│ in _find_and_load_unlocked:1331 │
│ in _load_unlocked:935 │
│ in exec_module:999 │
│ in _call_with_frames_removed:488 │
│ │
│ /home/amitchell/trials/hamilton-data-pipelines/.venv/lib/python3.12/site-packages/hamilton_ui/trackingserver_base/apps.py:8 in <module> │
│ │
│ 5 from django.conf import settings │
│ 6 from django.db import models │
│ 7 │
│ ❱ 8 from hamilton.telemetry import API_KEY, BASE_PROPERTIES, is_telemetry_enabled, send_event_json │
│ 9 │
│ 10 │
│ 11 def create_server_event_json(telemetry_key: str) -> dict: │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
ImportError: cannot import name 'API_KEY' from 'hamilton.telemetry'
Screenshots
(If applicable)
Steps to replicate behavior
- Install hamilton:
uv add "apache-hamilton[ui,sdk]"
- Run
hamilton ui
(Alternatively reproduced with just: uvx --from "apache-hamilton[ui,sdk]" hamilton ui
Library & System Information
python 3.12.13
apache-hamilton 1.90.0
sf-hamilton 1.90.0
sf-hamilton-sdk 0.8.0
sf-hamilton-ui 0.0.17
django 6.0.6
django-extensions 4.1
django-ninja 1.6.2
Expected behavior
ui launches locally.
Additional context
It seems related to commit #1512 where the telemetry was pulled out.
Current behavior
hamilton uifails withImportError: cannot import name 'API_KEY' from 'hamilton.telemetry'Stack Traces
Screenshots
(If applicable)
Steps to replicate behavior
uv add "apache-hamilton[ui,sdk]"hamilton ui(Alternatively reproduced with just:
uvx --from "apache-hamilton[ui,sdk]" hamilton uiLibrary & System Information
python 3.12.13
apache-hamilton 1.90.0
sf-hamilton 1.90.0
sf-hamilton-sdk 0.8.0
sf-hamilton-ui 0.0.17
django 6.0.6
django-extensions 4.1
django-ninja 1.6.2
Expected behavior
ui launches locally.
Additional context
It seems related to commit #1512 where the telemetry was pulled out.