Skip to content

Commit 639cac8

Browse files
authored
fix(recommendation)!: remove recommendation client in favor of personalization (#554)
| Q | A | ----------------- | ---------- | Bug fix? | no | New feature? | no | BC breaks? | yes | Related Issue | Fix #... <!-- will close issue automatically, if any --> | Need Doc update | no ## Describe your change https://algolia.atlassian.net/browse/DI-1010 ~Months~ years ago we added a deprecation notice for the recommendation client, since we will now release a new major, we can remove anything related to this client. deprecation PR #536
1 parent 2d4a7e2 commit 639cac8

File tree

7 files changed

+8
-297
lines changed

7 files changed

+8
-297
lines changed

algoliasearch/configs.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -110,22 +110,6 @@ def build_hosts(self):
110110
)
111111

112112

113-
class RecommendationConfig(Config):
114-
def __init__(self, app_id=None, api_key=None, region=None):
115-
# type: (Optional[str], Optional[str], Optional[str]) -> None
116-
117-
self._region = "us" if region is None else region
118-
119-
super(RecommendationConfig, self).__init__(app_id, api_key)
120-
121-
def build_hosts(self):
122-
# type: () -> HostsCollection
123-
124-
return HostsCollection(
125-
[Host("{}.{}.{}".format("recommendation", self._region, "algolia.com"))]
126-
)
127-
128-
129113
class PersonalizationConfig(Config):
130114
def __init__(self, app_id=None, api_key=None, region=None):
131115
# type: (Optional[str], Optional[str], Optional[str]) -> None

algoliasearch/recommendation_client.py

Lines changed: 0 additions & 137 deletions
This file was deleted.

algoliasearch/recommendation_client_async.py

Lines changed: 0 additions & 40 deletions
This file was deleted.

algoliasearch/search_client.py

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -334,45 +334,6 @@ def wait_task(self, index_name, task_id, request_options=None):
334334

335335
self.init_index(index_name).wait_task(task_id, request_options)
336336

337-
def set_personalization_strategy(self, strategy, request_options=None):
338-
# type: (dict, Optional[Union[dict, RequestOptions]]) -> dict
339-
340-
warnings.warn(
341-
"`%s.%s` is deprecated, use `%s.%s` instead."
342-
% (
343-
"SearchClient",
344-
"set_personalization_strategy",
345-
"PersonalizationClient",
346-
"set_personalization_strategy",
347-
),
348-
DeprecationWarning,
349-
)
350-
351-
return self._transporter.write(
352-
Verb.POST,
353-
"1/recommendation/personalization/strategy",
354-
strategy,
355-
request_options,
356-
)
357-
358-
def get_personalization_strategy(self, request_options=None):
359-
# type: (Optional[Union[dict, RequestOptions]]) -> dict
360-
361-
warnings.warn(
362-
"`%s.%s` is deprecated, use `%s.%s` instead."
363-
% (
364-
"SearchClient",
365-
"get_personalization_strategy",
366-
"PersonalizationClient",
367-
"get_personalization_strategy",
368-
),
369-
DeprecationWarning,
370-
)
371-
372-
return self._transporter.read(
373-
Verb.GET, "1/recommendation/personalization/strategy", None, request_options
374-
)
375-
376337
def save_dictionary_entries(
377338
self, dictionary, dictionary_entries, request_options=None
378339
):

tests/features/test_recommendation_client.py

Lines changed: 0 additions & 46 deletions
This file was deleted.

tests/helpers/factory.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from algoliasearch.insights_client import InsightsClient
1313
from algoliasearch.search_client import SearchClient, SearchConfig
1414
from algoliasearch.recommend_client import RecommendClient
15-
from algoliasearch.recommendation_client import RecommendationClient
1615
from algoliasearch.personalization_client import PersonalizationClient
1716
from algoliasearch.http.hosts import HostsCollection, Host
1817
from faker import Faker
@@ -90,24 +89,6 @@ def recommend_client(app_id=None, api_key=None):
9089

9190
return Factory.decide(RecommendClient.create(app_id, api_key))
9291

93-
@staticmethod
94-
def recommendation_client(app_id=None, api_key=None):
95-
# type: (Optional[str], Optional[str]) -> RecommendationClient
96-
97-
warnings.warn(
98-
"`%s` is deprecated, use `%s` instead."
99-
% (
100-
"RecommendationClient",
101-
"PersonalizationClient",
102-
),
103-
DeprecationWarning,
104-
)
105-
106-
app_id = app_id if app_id is not None else Factory.get_app_id()
107-
api_key = api_key if api_key is not None else Factory.get_api_key()
108-
109-
return Factory.decide(RecommendationClient.create(app_id, api_key))
110-
11192
@staticmethod
11293
def personalization_client(app_id=None, api_key=None):
11394
# type: (Optional[str], Optional[str]) -> PersonalizationClient

tox.ini

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ envlist =
33
py{34,35,36,37,38,39,310,311}-sync
44
py{34,35,36,37,38,39,310,311}-async
55
format
6+
format-fix
67
types
78
install_command = python -m pip install --user {opts} {packages}
89

@@ -61,6 +62,13 @@ commands =
6162
black --check algoliasearch/ tests/
6263
flake8 algoliasearch/ tests/
6364

65+
[testenv:format-fix]
66+
basepython = python3.8
67+
deps =
68+
black {[versions]black}
69+
commands =
70+
black algoliasearch/ tests/
71+
6472
[testenv:release]
6573
basepython = python3.8
6674
deps =

0 commit comments

Comments
 (0)