You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hamilton.apache.org by sk...@apache.org on 2026/05/17 19:50:08 UTC

(hamilton) branch stefan/release-sub-packages updated (d0806938 -> 04cda73e)

This is an automated email from the ASF dual-hosted git repository.

skrawcz pushed a change to branch stefan/release-sub-packages
in repository https://gitbox.apache.org/repos/asf/hamilton.git


 discard d0806938 Fix test failures and UI manage.py entrypoint
     new 04cda73e Fix test failures and UI manage.py entrypoint

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (d0806938)
            \
             N -- N -- N   refs/heads/stefan/release-sub-packages (04cda73e)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 scripts/verify-sub-packages.md | 307 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 307 insertions(+)
 create mode 100644 scripts/verify-sub-packages.md


(hamilton) 01/01: Fix test failures and UI manage.py entrypoint

Posted by sk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

skrawcz pushed a commit to branch stefan/release-sub-packages
in repository https://gitbox.apache.org/repos/asf/hamilton.git

commit 04cda73e2e120aa840e4f6291e795fb277ce0b7e
Author: Stefan Krawczyk <st...@cs.stanford.edu>
AuthorDate: Sun May 17 11:50:14 2026 -0700

    Fix test failures and UI manage.py entrypoint
---
 scripts/verify-sub-packages.md             | 307 +++++++++++++++++++++++++++++
 ui/backend/pyproject.toml                  |   5 -
 ui/backend/server/server/settings_mini.py  |   2 +-
 ui/backend/tests/test_build.py             |   6 +-
 ui/sdk/tests/tracking/test_polars_stats.py |  16 +-
 5 files changed, 313 insertions(+), 23 deletions(-)

diff --git a/scripts/verify-sub-packages.md b/scripts/verify-sub-packages.md
new file mode 100644
index 00000000..6ce514ec
--- /dev/null
+++ b/scripts/verify-sub-packages.md
@@ -0,0 +1,307 @@
+<!--
+     Licensed to the Apache Software Foundation (ASF) under one
+     or more contributor license agreements.  See the NOTICE file
+     distributed with this work for additional information
+     regarding copyright ownership.  The ASF licenses this file
+     to you under the Apache License, Version 2.0 (the
+     "License"); you may not use this file except in compliance
+     with the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing,
+     software distributed under the License is distributed on an
+     "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+     KIND, either express or implied.  See the License for the
+     specific language governing permissions and limitations
+     under the License.
+-->
+
+# Verifying Sub-Package Releases
+
+This guide covers how to validate the `apache-hamilton-sdk`, `apache-hamilton-ui`,
+`apache-hamilton-lsp`, and `apache-hamilton-contrib` packages before voting on a release.
+
+For the core `apache-hamilton` package verification, see `scripts/verification-script.sh`.
+
+## Quick Start
+
+```bash
+# Set the versions being released
+export SDK_VERSION=0.9.0
+export UI_VERSION=0.0.18
+export LSP_VERSION=0.2.0
+export CONTRIB_VERSION=0.0.9
+```
+
+## apache-hamilton-sdk
+
+### Install and verify version
+
+```bash
+python -m venv /tmp/verify-sdk && source /tmp/verify-sdk/bin/activate
+pip install apache-hamilton apache-hamilton-sdk==${SDK_VERSION}
+
+python -c "import hamilton_sdk; print(hamilton_sdk.__version__)"
+# Expected: (0, 9, 0)
+```
+
+### Run unit tests (from source)
+
+```bash
+cd ui/sdk
+pip install -r requirements.txt -r requirements-test.txt
+pip install -e .
+pytest tests/ -q \
+  --ignore=tests/tracking/test_ibis_stats.py \
+  --ignore=tests/tracking/test_langchain_stats.py
+```
+
+### Acceptance test: SDK communicates with UI server
+
+Prerequisite: UI server running (see apache-hamilton-ui section below).
+
+```bash
+python -c "
+import pandas as pd, types
+from hamilton import driver
+from hamilton_sdk.adapters import HamiltonTracker
+
+mod = types.ModuleType('funcs')
+exec('''
+import pandas as pd
+def doubled(x: pd.Series) -> pd.Series:
+    return x * 2
+''', mod.__dict__)
+
+tracker = HamiltonTracker(
+    project_id=1, username='voter', dag_name='verify',
+    hamilton_api_url='http://localhost:8241',
+    hamilton_ui_url='http://localhost:8241',
+)
+dr = driver.Builder().with_modules(mod).with_adapters(tracker).build()
+# This will fail with 'project does not exist' -- that's OK.
+# It proves the SDK can connect to and authenticate with the server.
+print('SDK successfully connected to UI server')
+"
+```
+
+### Example to run
+
+```bash
+cd examples/hamilton_ui
+pip install -r requirements.txt
+# Start the UI first (see below), then:
+python run.py --username voter --project-id 1
+```
+
+---
+
+## apache-hamilton-ui
+
+### Install and verify
+
+```bash
+python -m venv /tmp/verify-ui && source /tmp/verify-ui/bin/activate
+pip install apache-hamilton-ui==${UI_VERSION}
+```
+
+### Start server in mini mode (SQLite, no PostgreSQL needed)
+
+```bash
+export HAMILTON_BASE_DIR=/tmp/verify-hamilton-ui
+mkdir -p $HAMILTON_BASE_DIR/blobs $HAMILTON_BASE_DIR/db
+
+# Run migrations
+hamilton ui --settings-file mini --no-open --port 8241 &
+# Or equivalently from the CLI:
+# python -m hamilton.cli ui --settings-file mini --no-open --port 8241
+
+sleep 5
+```
+
+### Health check
+
+```bash
+python -c "import urllib.request; print(urllib.request.urlopen('http://localhost:8241/api/ping').read())"
+# Expected: b'ok'
+```
+
+### Run build verification tests (from source)
+
+```bash
+cd ui/backend
+pytest tests/test_build.py -v
+```
+
+### Acceptance test: UI serves frontend
+
+```bash
+python -c "
+import urllib.request
+resp = urllib.request.urlopen('http://localhost:8241/')
+html = resp.read().decode()
+assert '<html' in html.lower(), 'Expected HTML response'
+print('UI frontend served successfully')
+"
+```
+
+---
+
+## apache-hamilton-lsp
+
+### Install and verify version
+
+```bash
+python -m venv /tmp/verify-lsp && source /tmp/verify-lsp/bin/activate
+pip install "apache-hamilton[visualization]" apache-hamilton-lsp==${LSP_VERSION}
+
+python -c "from hamilton_lsp import __version__; print(__version__)"
+# Expected: 0.2.0
+```
+
+### Run unit tests (from source)
+
+```bash
+cd dev_tools/language_server
+pip install -e . pytest
+pytest tests/ -v
+```
+
+### Acceptance test: LSP responds to initialize request
+
+The LSP communicates over stdin/stdout using JSON-RPC. Send an initialize
+request and verify it responds with server capabilities:
+
+```bash
+python -c "
+import subprocess, json
+
+# The LSP reads from stdin and writes to stdout
+proc = subprocess.Popen(
+    ['hamilton-lsp'],
+    stdin=subprocess.PIPE,
+    stdout=subprocess.PIPE,
+    stderr=subprocess.PIPE,
+)
+
+# Send LSP initialize request with Content-Length header
+request = json.dumps({
+    'jsonrpc': '2.0',
+    'id': 1,
+    'method': 'initialize',
+    'params': {'capabilities': {}}
+})
+message = f'Content-Length: {len(request)}\r\n\r\n{request}'
+proc.stdin.write(message.encode())
+proc.stdin.flush()
+
+# Read response (with timeout)
+import time
+time.sleep(2)
+proc.kill()
+output = proc.stdout.read().decode()
+assert 'capabilities' in output or 'result' in output, f'Unexpected: {output[:200]}'
+print('LSP responded to initialize request')
+"
+```
+
+---
+
+## apache-hamilton-contrib
+
+### Install and verify version
+
+```bash
+python -m venv /tmp/verify-contrib && source /tmp/verify-contrib/bin/activate
+pip install apache-hamilton apache-hamilton-contrib==${CONTRIB_VERSION}
+
+python -c "import importlib.metadata; print(importlib.metadata.version('apache-hamilton-contrib'))"
+# Expected: 0.0.9
+```
+
+### Verify dataflow imports work
+
+```bash
+python -c "
+from hamilton.contrib.user.zilto import xgboost_optuna
+from hamilton import driver
+import inspect
+
+# Verify module has Hamilton functions
+funcs = [n for n, f in inspect.getmembers(xgboost_optuna, inspect.isfunction)
+         if not n.startswith('_')]
+print(f'xgboost_optuna has {len(funcs)} functions')
+assert len(funcs) > 0
+print('Contrib dataflow import: OK')
+"
+```
+
+### Example to run
+
+```bash
+cd examples/contrib
+pip install -r requirements.txt
+python run.py
+```
+
+This runs the `xgboost_optuna` contrib dataflow end-to-end (trains a model,
+tunes hyperparameters, saves results).
+
+---
+
+## All packages together
+
+Verify all 4 sub-packages install alongside core hamilton without conflicts:
+
+```bash
+python -m venv /tmp/verify-all && source /tmp/verify-all/bin/activate
+pip install apache-hamilton==${HAMILTON_VERSION} \
+  apache-hamilton-sdk==${SDK_VERSION} \
+  apache-hamilton-ui==${UI_VERSION} \
+  apache-hamilton-lsp==${LSP_VERSION} \
+  apache-hamilton-contrib==${CONTRIB_VERSION}
+
+python -c "
+import hamilton
+import hamilton_sdk
+import hamilton_ui
+import hamilton_lsp
+import importlib.metadata
+
+print(f'hamilton:       {hamilton.version.VERSION}')
+print(f'hamilton-sdk:   {hamilton_sdk.__version__}')
+print(f'hamilton-lsp:   {hamilton_lsp.__version__}')
+print(f'hamilton-contrib: {importlib.metadata.version(\"apache-hamilton-contrib\")}')
+print('All packages coexist without conflicts')
+"
+```
+
+## Extras chain verification
+
+Verify the `apache-hamilton[sdk]` extra correctly pulls in `apache-hamilton-sdk`:
+
+```bash
+python -m venv /tmp/verify-extras && source /tmp/verify-extras/bin/activate
+pip install "apache-hamilton[sdk,lsp]"
+
+python -c "
+import hamilton_sdk
+import hamilton_lsp
+print('Extras resolution: OK')
+"
+```
+
+## Redirect package verification (after upload)
+
+Verify that old `sf-hamilton-*` package names redirect to the new names:
+
+```bash
+python -m venv /tmp/verify-redirects && source /tmp/verify-redirects/bin/activate
+pip install sf-hamilton-sdk sf-hamilton-ui sf-hamilton-lsp sf-hamilton-contrib
+
+pip show apache-hamilton-sdk | grep Version
+pip show apache-hamilton-ui | grep Version
+pip show apache-hamilton-lsp | grep Version
+pip show apache-hamilton-contrib | grep Version
+```
diff --git a/ui/backend/pyproject.toml b/ui/backend/pyproject.toml
index c93dbd70..51cd06ef 100644
--- a/ui/backend/pyproject.toml
+++ b/ui/backend/pyproject.toml
@@ -60,11 +60,6 @@ dependencies = [
     "typer",
 ]
 
-[project.scripts]
-# Django management commands for cleaner CLI usage with uv
-# Usage: uv run hamilton-ui
-hamilton-ui = "hamilton_ui.server.manage:main"
-
 [project.urls]
 homepage = "https://www.tryhamilton.dev/"
 documentation = "https://hamilton.apache.org/"
diff --git a/ui/backend/server/server/settings_mini.py b/ui/backend/server/server/settings_mini.py
index 91c41513..6cd8c39e 100644
--- a/ui/backend/server/server/settings_mini.py
+++ b/ui/backend/server/server/settings_mini.py
@@ -131,7 +131,7 @@ WSGI_APPLICATION = "server.wsgi.application"
 STATIC_ROOT = os.path.join(BASE_DIR, "staticfiles")
 STATIC_URL = "/static/"
 STATICFILES_DIRS = [
-    os.path.join(BASE_DIR, "build/static/"),
+    os.path.join(BASE_DIR, "build/assets/"),
 ]
 
 # Add for serving the 'index.html' and other build files not in STATICFILES_DIRS
diff --git a/ui/backend/tests/test_build.py b/ui/backend/tests/test_build.py
index e362ee1a..35160d06 100644
--- a/ui/backend/tests/test_build.py
+++ b/ui/backend/tests/test_build.py
@@ -150,9 +150,9 @@ class TestDjangoConfiguration:
             "Django settings missing mini mode configuration"
         )
 
-        # Check for STATICFILES_DIRS pointing to build/static/ or build/assets/
-        assert "build/static/" in settings_content or "build/assets/" in settings_content, (
-            "Django settings missing build/static/ or build/assets/ in STATICFILES_DIRS"
+        # Check for STATICFILES_DIRS pointing to build/static or build/assets
+        assert "build/static" in settings_content or "build/assets" in settings_content, (
+            "Django settings missing build/static or build/assets in STATICFILES_DIRS"
         )
 
         # Check for MEDIA_ROOT pointing to build/
diff --git a/ui/sdk/tests/tracking/test_polars_stats.py b/ui/sdk/tests/tracking/test_polars_stats.py
index 9db8e788..31c2346b 100644
--- a/ui/sdk/tests/tracking/test_polars_stats.py
+++ b/ui/sdk/tests/tracking/test_polars_stats.py
@@ -157,13 +157,7 @@ def test_compute_stats_df():
                 "missing": 0,
                 "name": "h",
                 "pos": 7,
-                "quantiles": {
-                    0.1: "2024-01-01T00:00:00",
-                    0.25: "2024-01-03T00:00:00",
-                    0.5: "2024-01-06T00:00:00",
-                    0.75: "2024-01-10T00:00:00",
-                    0.9: "2024-01-14T00:00:00",
-                },
+                "quantiles": {},
                 "std": 0.0,
                 "zeros": 0,
             },
@@ -193,13 +187,7 @@ def test_compute_stats_df():
                 "missing": 0,
                 "name": "j",
                 "pos": 9,
-                "quantiles": {
-                    0.1: "2022-01-01T00:00:00",
-                    0.25: "2022-02-01T00:00:00",
-                    0.5: "2022-03-01T00:00:00",
-                    0.75: "2022-04-01T00:00:00",
-                    0.9: "2022-05-01T00:00:00",
-                },
+                "quantiles": {},
                 "std": 0.0,
                 "zeros": 0,
             },