diff --git a/README.md b/README.md index b4089086..2e35f860 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,16 @@ SolveBio Python Client ====================== +# This package is deprecated. Please install and use quartzbio instead: + +```bash +pip install quartzbio +``` + +**This package will no longer be maintained after March 31, 2026.** + +**Migration guide: [https://github.com/quartzbio/quartzbio-python](https://github.com/quartzbio/quartzbio-python)** + This is the SolveBio Python package and command-line interface (CLI). This module is tested against Python 2.7, 3.6, 3.7, 3.8, 3.10, PyPy and PyPy3. diff --git a/setup.py b/setup.py index 1664905b..cf5a9fed 100644 --- a/setup.py +++ b/setup.py @@ -55,7 +55,7 @@ setup( name='solvebio', version=VERSION, - description='The SolveBio Python client', + description='The SolveBio Python client (DEPRECATED)', long_description=long_description, long_description_content_type='text/markdown', python_requires='>=3.8', @@ -74,6 +74,7 @@ 'solvebio-recipes = recipes.sync_recipes:sync_recipes'] }, classifiers=[ + 'Development Status :: 7 - Inactive', 'Intended Audience :: Science/Research', 'Operating System :: OS Independent', 'Programming Language :: Python', diff --git a/solvebio/__init__.py b/solvebio/__init__.py index 460b3848..e36ddae0 100644 --- a/solvebio/__init__.py +++ b/solvebio/__init__.py @@ -13,6 +13,7 @@ import os as _os import logging as _logging +import warnings from typing import Literal from .help import open_help as _open_help @@ -99,6 +100,45 @@ def _set_cached_api_host(host): from .version import VERSION # noqa from .errors import SolveError + + +_deprecation_warning_shown = False + + +def print_deprecation_notice(): + """ + Shows the deprecation warning for the SolveBio Python client. + Only shows once per session to avoid repetition. + """ + global _deprecation_warning_shown + + if _deprecation_warning_shown: + return + + _deprecation_warning_shown = True + + message = """ + !!! Deprecation Notice + + The SolveBio Python client is deprecated and will no longer be maintained after March 31, 2026. + + We recommend migrating to the QuartzBio python client: + https://github.com/quartzbio/quartzbio-python + + """ + + if api_host is not None: + message += f"\nOr using the QuartzBio REST API: {api_host.replace('.api', '')}/swagger" + + # Show warning and also print to ensure visibility + warnings.warn( + message, + DeprecationWarning, + stacklevel=2, + ) + print(f"{message}") + + from .query import Query, BatchQuery, Filter, GenomicFilter from .global_search import GlobalSearch from .annotate import Annotator, Expression @@ -176,6 +216,8 @@ def login( client.set_credentials( api_host, token, token_type=token_type, raise_on_missing=not debug, debug=debug ) + # Show deprecation notice after credentials are set + print_deprecation_notice() client.set_user_agent(name=name, version=version) diff --git a/solvebio/cli/auth.py b/solvebio/cli/auth.py index ba147243..71ec310d 100644 --- a/solvebio/cli/auth.py +++ b/solvebio/cli/auth.py @@ -27,6 +27,7 @@ def login_and_save_credentials(*args): # Print information about the current user if not client.is_logged_in(): print("login: client is not logged in!") + solvebio.print_deprecation_notice() # Verify if user has provided the wrong credentials file if client._host: @@ -56,9 +57,10 @@ def logout(*args): """ if get_credentials(): delete_credentials() - print('You have been logged out.') + print("You have been logged out.") else: - print('You are not logged-in.') + print("You are not logged-in.") + solvebio.print_deprecation_notice() def whoami(*args, **kwargs): @@ -69,7 +71,7 @@ def whoami(*args, **kwargs): try: user = client.whoami() except Exception as e: - print(u'{} (code: {})'.format(e.message, e.status_code)) + print("{} (code: {})".format(e.message, e.status_code)) else: print_user(user) @@ -78,7 +80,9 @@ def print_user(user): """ Prints information about the current user. """ - email = user['email'] - domain = user['account']['domain'] - print(f'You are logged-in to the "{domain}" domain as {email}' - f' (server: {solvebio.get_api_host()}).') + email = user["email"] + domain = user["account"]["domain"] + print( + f'You are logged-in to the "{domain}" domain as {email}' + f" (server: {solvebio.get_api_host()})." + ) diff --git a/solvebio/cli/ipython_init.py b/solvebio/cli/ipython_init.py index 5e1eba24..bde3eb85 100644 --- a/solvebio/cli/ipython_init.py +++ b/solvebio/cli/ipython_init.py @@ -32,6 +32,7 @@ from solvebio import DatasetSnapshotTask # noqa from solvebio import GlobalSearch # noqa from solvebio import Group # noqa +from solvebio import print_deprecation_notice # noqa from solvebio.utils.printing import pager # noqa # Add some convenience functions to the interactive shell @@ -39,4 +40,6 @@ from solvebio.cli.auth import whoami # noqa from solvebio.cli.auth import get_credentials # noqa +# Show deprecation notice when starting IPython shell +print_deprecation_notice() whoami()