Skip to content

Commit 3e028cd

Browse files
authored
Use nmslib-metabrainz for Python 3.11 and upper (#180)
The official nmslib doesn't provide wheels for Python 3.11 and 3.12. For convenience, let's allow the use of the forked version wheel, i.e., nmslib-metabrainz.
1 parent ae77f27 commit 3e028cd

File tree

5 files changed

+41
-10
lines changed

5 files changed

+41
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- `nbformat >= 4.2.0` dependency to `[visuals]` extra ([#169](https://github.com/MobileTeleSystems/RecTools/pull/169))
1414
- `filter_interactions` method of `Dataset` ([#177](https://github.com/MobileTeleSystems/RecTools/pull/177))
1515
- `on_unsupported_targets` parameter to `recommend` and `recommend_to_items` model methods ([#177](https://github.com/MobileTeleSystems/RecTools/pull/177))
16+
- Use nmslib-metabrainz for Python 3.11 and upper ([#180](https://github.com/MobielTeleSystems/RecTools/pull/180))
1617

1718
### Fixed
1819
- `display()` method in `MetricsApp` ([#169](https://github.com/MobileTeleSystems/RecTools/pull/169))

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ install: .venv .reports
6161
poetry run pytest ${TESTS} --cov=${SOURCES} --cov-report=xml
6262

6363
.doctest:
64-
poetry run pytest --doctest-modules ${SOURCES} --ignore=rectools/tools/ann.py --ignore=rectools/models/lightfm.py
64+
poetry run pytest --doctest-modules ${SOURCES} --ignore=rectools/models/lightfm.py
6565

6666
coverage: .venv .reports
6767
poetry run coverage run --source ${SOURCES} --module pytest

poetry.lock

Lines changed: 34 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ authors = [
1414
"Mikhail Khasykov <[email protected]>",
1515
"Mike Sokolov <[email protected]>",
1616
"Andrey Semenov <[email protected]>",
17-
"Maxim Lukin <[email protected]>"
17+
"Maxim Lukin <[email protected]>"
1818
]
1919
maintainers = [
2020
"Emiliy Feldman <[email protected]>",
@@ -74,6 +74,8 @@ typeguard = "^4.1.0"
7474
rectools-lightfm = {version="1.17.1", python = "<3.12", optional = true}
7575

7676
nmslib = {version = "^2.0.4", python = "<3.11", optional = true}
77+
# nmslib officialy doens't support Python 3.11 and 3.12. Use https://github.com/metabrainz/nmslib-metabrainz instead
78+
nmslib-metabrainz = {version = "^2.1.3", python = ">=3.11, <3.13", optional = true}
7779

7880
# The latest torch version available for MacOSX + x86_64 is 2.2.2
7981
torch = [
@@ -89,12 +91,12 @@ nbformat = {version = ">=4.2.0", optional = true}
8991

9092
[tool.poetry.extras]
9193
lightfm = ["rectools-lightfm"]
92-
nmslib = ["nmslib"]
94+
nmslib = ["nmslib", "nmslib-metabrainz"]
9395
torch = ["torch", "pytorch-lightning"]
9496
visuals = ["ipywidgets", "plotly", "nbformat"]
9597
all = [
9698
"rectools-lightfm",
97-
"nmslib",
99+
"nmslib", "nmslib-metabrainz",
98100
"torch", "pytorch-lightning",
99101
"ipywidgets", "plotly", "nbformat",
100102
]

tests/tools/test_ann.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414

1515
import pickle
16-
import sys
1716
from typing import Callable, Dict, Hashable, List, Union
1817

1918
import numpy as np
@@ -22,8 +21,6 @@
2221
from rectools.dataset import IdMap
2322
from rectools.tools import ItemToItemAnnRecommender, UserToItemAnnRecommender
2423

25-
pytestmark = pytest.mark.skipif(sys.version_info >= (3, 11), reason="`nmslib` is not compatible with Python >= 3.11")
26-
2724

2825
class TestItemToItemAnnRecommender:
2926
@pytest.fixture

0 commit comments

Comments
 (0)