From 637adb8c4d9ac3e3d0f807920f5cf5b1eae9186e Mon Sep 17 00:00:00 2001 From: elijahbenizzy Date: Thu, 21 Mar 2024 14:16:32 -0700 Subject: [PATCH] Removes hamilton dependency This way we have... zero dependencies! --- burr/integrations/hamilton.py | 11 ++++++++++- examples/gpt/requirements.txt | 1 + pyproject.toml | 14 +++++++++----- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/burr/integrations/hamilton.py b/burr/integrations/hamilton.py index f9b8bfdd..4a733e9f 100644 --- a/burr/integrations/hamilton.py +++ b/burr/integrations/hamilton.py @@ -1,7 +1,16 @@ import dataclasses from typing import Any, Dict, Literal, Tuple, Union -from hamilton.driver import Driver +from burr.integrations.base import require_plugin + +try: + from hamilton.driver import Driver +except ImportError as e: + require_plugin( + e, + ["sf-hamilton"], + "hamilton", + ) from burr.core import Action, State diff --git a/examples/gpt/requirements.txt b/examples/gpt/requirements.txt index d75c4699..61560bab 100644 --- a/examples/gpt/requirements.txt +++ b/examples/gpt/requirements.txt @@ -1,2 +1,3 @@ +burr[hamilton] burr[streamlit] openai diff --git a/pyproject.toml b/pyproject.toml index e73f8bcf..e65629f4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,9 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "burr" version = "0.9.0" -dependencies = [ - "sf-hamilton>=1.47.0" -] +dependencies = [] # yes, there are none requires-python = ">=3.9" authors = [ {name = "Elijah ben Izzy", email = "elijah@dagworks.io"}, @@ -30,7 +28,12 @@ classifiers = [ streamlit = [ "streamlit", "graphviz", - "matplotlib" + "matplotlib", + "sf-hamilton" +] + +hamilton = [ + "sf-hamilton" ] graphviz = [ @@ -44,6 +47,7 @@ postgresql = [ tests = [ "pytest", "pytest-asyncio", + "burr[hamilton]" ] documentation = [ @@ -79,7 +83,7 @@ tracking = [ ] learn = [ - "burr[tracking,streamlit,graphviz]" + "burr[tracking,streamlit,graphviz,hamilton]" ] start = [