From 8ccad15024e299f8b1bbf2ba69b7620e3ad9d1c4 Mon Sep 17 00:00:00 2001 From: Zain Hasan Date: Fri, 5 Dec 2025 10:50:31 -0800 Subject: [PATCH 1/4] add deprecation notices --- README.md | 16 ++++++++++- pyproject.toml | 3 ++- src/together/__init__.py | 57 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 826a552e..b26a4244 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,21 @@ -# Together Python API library +> [!CAUTION] +> ## ⚠️ DEPRECATION NOTICE +> +> **This package (`together`) is deprecated and will no longer be maintained after January 2026.** +> +> Please migrate to the new SDK: **[together-ai](https://github.com/togethercomputer/together-py)** +> +> 📖 **Migration Guide:** [https://docs.together.ai/docs/pythonv2-migration-guide](https://docs.together.ai/docs/pythonv2-migration-guide) +> +> ```bash +> pip uninstall together +> pip install together-ai +> ``` + +# Together Python API library (DEPRECATED) [![PyPI version](https://img.shields.io/pypi/v/together.svg)](https://pypi.org/project/together/) [![Discord](https://dcbadge.limes.pink/api/server/https://discord.gg/9Rk6sSeWEG?style=flat&theme=discord-inverted)](https://discord.com/invite/9Rk6sSeWEG) diff --git a/pyproject.toml b/pyproject.toml index 7acfa3b4..cc9f4bf1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,10 +14,11 @@ build-backend = "poetry.masonry.api" name = "together" version = "1.5.31" authors = ["Together AI "] -description = "Python client for Together's Cloud Platform!" +description = "[DEPRECATED - Use together-py instead] Python client for Together's Cloud Platform. See https://github.com/togethercomputer/together-py for the new SDK." readme = "README.md" license = "Apache-2.0" classifiers = [ + "Development Status :: 7 - Inactive", "Programming Language :: Python :: 3", "License :: OSI Approved :: Apache Software License", "Operating System :: POSIX :: Linux", diff --git a/src/together/__init__.py b/src/together/__init__.py index b4e4110d..e65def57 100644 --- a/src/together/__init__.py +++ b/src/together/__init__.py @@ -1,5 +1,62 @@ from __future__ import annotations +import os +import sys +import warnings + +# ============================================================================= +# DEPRECATION NOTICE +# ============================================================================= +_DEPRECATION_MESSAGE = """ +================================================================================ +DEPRECATION WARNING: The 'together' package is deprecated and will no longer +be maintained after January 2026. + +Please migrate to the new SDK: https://github.com/togethercomputer/together-py + +Migration guide: https://docs.together.ai/docs/pythonv2-migration-guide +================================================================================ +""" + +# Show deprecation warning (visible to developers with warnings enabled) +warnings.warn( + "The 'together' package is deprecated and will no longer be maintained after " + "January 2026. Please migrate to the new SDK: " + "https://github.com/togethercomputer/together-py " + "Migration guide: https://docs.together.ai/docs/pythonv2-migration-guide", + DeprecationWarning, + stacklevel=2, +) + +# Also print a visible notice to stderr (unless suppressed) +if not os.environ.get("TOGETHER_SUPPRESS_DEPRECATION_WARNING"): + try: + from rich.console import Console + from rich.panel import Panel + + console = Console(stderr=True) + console.print( + Panel( + "[bold yellow]DEPRECATION WARNING[/bold yellow]\n\n" + "The [cyan]together[/cyan] package is deprecated and will no longer " + "be maintained after [bold]January 2026[/bold].\n\n" + "Please migrate to the new SDK:\n" + "[link=https://github.com/togethercomputer/together-py]" + "https://github.com/togethercomputer/together-py[/link]\n\n" + "Migration guide:\n" + "[link=https://docs.together.ai/docs/pythonv2-migration-guide]" + "https://docs.together.ai/docs/pythonv2-migration-guide[/link]\n\n" + "[dim]Set TOGETHER_SUPPRESS_DEPRECATION_WARNING=1 to hide this message.[/dim]", + title="⚠️ Deprecation Notice", + border_style="yellow", + ) + ) + except ImportError: + # Fallback if rich is not available + print(_DEPRECATION_MESSAGE, file=sys.stderr) + +# ============================================================================= + from contextvars import ContextVar from typing import TYPE_CHECKING, Callable From 014c06f4cf511770b6b47f94191aeca14509e5b1 Mon Sep 17 00:00:00 2001 From: Zain Hasan Date: Fri, 5 Dec 2025 10:59:53 -0800 Subject: [PATCH 2/4] update toml --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index cc9f4bf1..cc583538 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,6 @@ description = "[DEPRECATED - Use together-py instead] Python client for Together readme = "README.md" license = "Apache-2.0" classifiers = [ - "Development Status :: 7 - Inactive", "Programming Language :: Python :: 3", "License :: OSI Approved :: Apache Software License", "Operating System :: POSIX :: Linux", From e5fe771cd41225dda97ee2c981defb6ec318555c Mon Sep 17 00:00:00 2001 From: Zain Hasan Date: Fri, 5 Dec 2025 11:21:18 -0800 Subject: [PATCH 3/4] info instead of warning --- README.md | 30 ++++++++++++++++------- pyproject.toml | 2 +- src/together/__init__.py | 52 ++++++++++++++++------------------------ 3 files changed, 44 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index b26a4244..cc867246 100644 --- a/README.md +++ b/README.md @@ -4,21 +4,35 @@ -> [!CAUTION] -> ## ⚠️ DEPRECATION NOTICE +> [!NOTE] +> ## 🚀 Together Python SDK 2.0 is now available! > -> **This package (`together`) is deprecated and will no longer be maintained after January 2026.** -> -> Please migrate to the new SDK: **[together-ai](https://github.com/togethercomputer/together-py)** +> Check out the new SDK: **[together-py](https://github.com/togethercomputer/together-py)** > > 📖 **Migration Guide:** [https://docs.together.ai/docs/pythonv2-migration-guide](https://docs.together.ai/docs/pythonv2-migration-guide) > +> ### Install the Beta +> +> **Using uv (Recommended):** +> ```bash +> # Install uv if you haven't already +> curl -LsSf https://astral.sh/uv/install.sh | sh +> +> # Install together python SDK +> uv add together --prerelease allow +> +> # Or upgrade an existing installation +> uv sync --upgrade-package together --prerelease allow +> ``` +> +> **Using pip:** > ```bash -> pip uninstall together -> pip install together-ai +> pip install --pre together > ``` +> +> This package will be maintained until January 2026. -# Together Python API library (DEPRECATED) +# Together Python API library [![PyPI version](https://img.shields.io/pypi/v/together.svg)](https://pypi.org/project/together/) [![Discord](https://dcbadge.limes.pink/api/server/https://discord.gg/9Rk6sSeWEG?style=flat&theme=discord-inverted)](https://discord.com/invite/9Rk6sSeWEG) diff --git a/pyproject.toml b/pyproject.toml index cc583538..fb5a9266 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ build-backend = "poetry.masonry.api" name = "together" version = "1.5.31" authors = ["Together AI "] -description = "[DEPRECATED - Use together-py instead] Python client for Together's Cloud Platform. See https://github.com/togethercomputer/together-py for the new SDK." +description = "Python client for Together's Cloud Platform! Note: SDK 2.0 is now available at https://github.com/togethercomputer/together-py" readme = "README.md" license = "Apache-2.0" classifiers = [ diff --git a/src/together/__init__.py b/src/together/__init__.py index e65def57..196ab6da 100644 --- a/src/together/__init__.py +++ b/src/together/__init__.py @@ -2,34 +2,24 @@ import os import sys -import warnings # ============================================================================= -# DEPRECATION NOTICE +# SDK 2.0 ANNOUNCEMENT # ============================================================================= -_DEPRECATION_MESSAGE = """ +_ANNOUNCEMENT_MESSAGE = """ ================================================================================ -DEPRECATION WARNING: The 'together' package is deprecated and will no longer -be maintained after January 2026. - -Please migrate to the new SDK: https://github.com/togethercomputer/together-py +Together Python SDK 2.0 is now available! +Install: pip install --pre together +New SDK: https://github.com/togethercomputer/together-py Migration guide: https://docs.together.ai/docs/pythonv2-migration-guide + +This package will be maintained until January 2026. ================================================================================ """ -# Show deprecation warning (visible to developers with warnings enabled) -warnings.warn( - "The 'together' package is deprecated and will no longer be maintained after " - "January 2026. Please migrate to the new SDK: " - "https://github.com/togethercomputer/together-py " - "Migration guide: https://docs.together.ai/docs/pythonv2-migration-guide", - DeprecationWarning, - stacklevel=2, -) - -# Also print a visible notice to stderr (unless suppressed) -if not os.environ.get("TOGETHER_SUPPRESS_DEPRECATION_WARNING"): +# Show info banner (unless suppressed) +if not os.environ.get("TOGETHER_NO_BANNER"): try: from rich.console import Console from rich.panel import Panel @@ -37,23 +27,23 @@ console = Console(stderr=True) console.print( Panel( - "[bold yellow]DEPRECATION WARNING[/bold yellow]\n\n" - "The [cyan]together[/cyan] package is deprecated and will no longer " - "be maintained after [bold]January 2026[/bold].\n\n" - "Please migrate to the new SDK:\n" - "[link=https://github.com/togethercomputer/together-py]" - "https://github.com/togethercomputer/together-py[/link]\n\n" - "Migration guide:\n" - "[link=https://docs.together.ai/docs/pythonv2-migration-guide]" + "[bold cyan]Together Python SDK 2.0 is now available![/bold cyan]\n\n" + "Install the beta:\n" + "[green]pip install --pre together[/green] or " + "[green]uv add together --prerelease allow[/green]\n\n" + "New SDK: [link=https://github.com/togethercomputer/together-py]" + "https://github.com/togethercomputer/together-py[/link]\n" + "Migration guide: [link=https://docs.together.ai/docs/pythonv2-migration-guide]" "https://docs.together.ai/docs/pythonv2-migration-guide[/link]\n\n" - "[dim]Set TOGETHER_SUPPRESS_DEPRECATION_WARNING=1 to hide this message.[/dim]", - title="⚠️ Deprecation Notice", - border_style="yellow", + "[dim]This package will be maintained until January 2026.\n" + "Set TOGETHER_NO_BANNER=1 to hide this message.[/dim]", + title="🚀 New SDK Available", + border_style="cyan", ) ) except ImportError: # Fallback if rich is not available - print(_DEPRECATION_MESSAGE, file=sys.stderr) + print(_ANNOUNCEMENT_MESSAGE, file=sys.stderr) # ============================================================================= From 240ddc78b1c8d22aa175c2c922eca198d58477a1 Mon Sep 17 00:00:00 2001 From: Zain Hasan Date: Fri, 5 Dec 2025 11:26:03 -0800 Subject: [PATCH 4/4] wip --- src/together/__init__.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/together/__init__.py b/src/together/__init__.py index 196ab6da..0866b223 100644 --- a/src/together/__init__.py +++ b/src/together/__init__.py @@ -41,9 +41,13 @@ border_style="cyan", ) ) - except ImportError: - # Fallback if rich is not available - print(_ANNOUNCEMENT_MESSAGE, file=sys.stderr) + except Exception: + # Fallback for any error (ImportError, OSError in daemons, rich errors, etc.) + # Banner display should never break module imports + try: + print(_ANNOUNCEMENT_MESSAGE, file=sys.stderr) + except Exception: + pass # Silently ignore if even stderr is unavailable # =============================================================================