Skip to content

Commit 8d5e794

Browse files
committed
Add deprecation message on all sessions
1 parent f3d2833 commit 8d5e794

3 files changed

Lines changed: 53 additions & 7 deletions

File tree

solvebio/__init__.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,43 @@ def _set_cached_api_host(host):
9999

100100
from .version import VERSION # noqa
101101
from .errors import SolveError
102+
103+
104+
_deprecation_notice_shown = False
105+
106+
107+
def print_deprecation_notice():
108+
"""
109+
Prints the deprecation notice for the SolveBio Python client.
110+
Only shows once per session to avoid repetition.
111+
"""
112+
global _deprecation_notice_shown
113+
114+
if _deprecation_notice_shown:
115+
return
116+
117+
_deprecation_notice_shown = True
118+
119+
print(
120+
"""
121+
!!! Deprecation Notice
122+
123+
The SolveBio Python client is deprecated and will no longer be maintained after March 31, 2026.
124+
125+
We recommend migrating to the QuartzBio python client:
126+
https://github.com/quartzbio/quartzbio-python
127+
"""
128+
)
129+
130+
if api_host is not None:
131+
print(
132+
f"""
133+
Or using the QuartzBio REST API:
134+
{api_host.replace(".api","")}/swagger
135+
"""
136+
)
137+
138+
102139
from .query import Query, BatchQuery, Filter, GenomicFilter
103140
from .global_search import GlobalSearch
104141
from .annotate import Annotator, Expression
@@ -176,6 +213,8 @@ def login(
176213
client.set_credentials(
177214
api_host, token, token_type=token_type, raise_on_missing=not debug, debug=debug
178215
)
216+
# Show deprecation notice after credentials are set
217+
print_deprecation_notice()
179218

180219
client.set_user_agent(name=name, version=version)
181220

solvebio/cli/auth.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def login_and_save_credentials(*args):
2727
# Print information about the current user
2828
if not client.is_logged_in():
2929
print("login: client is not logged in!")
30+
solvebio.print_deprecation_notice()
3031

3132
# Verify if user has provided the wrong credentials file
3233
if client._host:
@@ -56,9 +57,10 @@ def logout(*args):
5657
"""
5758
if get_credentials():
5859
delete_credentials()
59-
print('You have been logged out.')
60+
print("You have been logged out.")
6061
else:
61-
print('You are not logged-in.')
62+
print("You are not logged-in.")
63+
solvebio.print_deprecation_notice()
6264

6365

6466
def whoami(*args, **kwargs):
@@ -69,7 +71,7 @@ def whoami(*args, **kwargs):
6971
try:
7072
user = client.whoami()
7173
except Exception as e:
72-
print(u'{} (code: {})'.format(e.message, e.status_code))
74+
print("{} (code: {})".format(e.message, e.status_code))
7375
else:
7476
print_user(user)
7577

@@ -78,7 +80,9 @@ def print_user(user):
7880
"""
7981
Prints information about the current user.
8082
"""
81-
email = user['email']
82-
domain = user['account']['domain']
83-
print(f'You are logged-in to the "{domain}" domain as {email}'
84-
f' (server: {solvebio.get_api_host()}).')
83+
email = user["email"]
84+
domain = user["account"]["domain"]
85+
print(
86+
f'You are logged-in to the "{domain}" domain as {email}'
87+
f" (server: {solvebio.get_api_host()})."
88+
)

solvebio/cli/ipython_init.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,14 @@
3232
from solvebio import DatasetSnapshotTask # noqa
3333
from solvebio import GlobalSearch # noqa
3434
from solvebio import Group # noqa
35+
from solvebio import print_deprecation_notice # noqa
3536
from solvebio.utils.printing import pager # noqa
3637

3738
# Add some convenience functions to the interactive shell
3839
from solvebio.cli.auth import logout # noqa
3940
from solvebio.cli.auth import whoami # noqa
4041
from solvebio.cli.auth import get_credentials # noqa
4142

43+
# Show deprecation notice when starting IPython shell
44+
print_deprecation_notice()
4245
whoami()

0 commit comments

Comments
 (0)