diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8e07179 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +0001-update-colorlog-pinning.patch eol=crlf +0002-update-randomstate-to-default_rng-for-hyperopt.patch eol=crlf diff --git a/README.md b/README.md index 2fd97d8..cd83a0d 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ -About -feedstock +About recbole-feedstock ======================= Feedstock license: [BSD-3-Clause](LICENSE) -Home: +Home: https://recbole.io -Package license: +Package license: MIT -Summary: +Summary: RecBole is developed based on Python and PyTorch for reproducing and developing recommendation algorithms in a unified, comprehensive and efficient framework for research purpose. In the first version, our library includes 53 recommendation algorithms, covering four major categories: General Recommendation, Sequential Recommendation, Context-aware Recommendation and Knowledge-based Recommendation. Current release info @@ -15,19 +15,19 @@ Current release info | Name | Downloads | Version | Platforms | | --- | --- | --- | --- | -| [![Conda Recipe](https://img.shields.io/badge/recipe--green.svg)](https://anaconda.org/anaconda/) | [![Conda Downloads](https://img.shields.io/conda/dn/anaconda/.svg)](https://anaconda.org/anaconda/) | [![Conda Version](https://img.shields.io/conda/vn/anaconda/.svg)](https://anaconda.org/anaconda/) | [![Conda Platforms](https://img.shields.io/conda/pn/anaconda/.svg)](https://anaconda.org/anaconda/) | +| [![Conda Recipe](https://img.shields.io/badge/recipe-recbole-green.svg)](https://anaconda.org/anaconda/recbole) | [![Conda Downloads](https://img.shields.io/conda/dn/anaconda/recbole.svg)](https://anaconda.org/anaconda/recbole) | [![Conda Version](https://img.shields.io/conda/vn/anaconda/recbole.svg)](https://anaconda.org/anaconda/recbole) | [![Conda Platforms](https://img.shields.io/conda/pn/anaconda/recbole.svg)](https://anaconda.org/anaconda/recbole) | -Installing +Installing recbole ================== -Installing `` from the main channel can be achieved by: +Installing `recbole` from the main channel can be achieved by: ``` -conda install +conda install recbole ``` -It is possible to list all of the versions of `` available on your platform with `conda`: +It is possible to list all of the versions of `recbole` available on your platform with `conda`: ``` -conda search +conda search recbole ``` \ No newline at end of file diff --git a/abs.yaml b/abs.yaml new file mode 100644 index 0000000..1ed0d29 --- /dev/null +++ b/abs.yaml @@ -0,0 +1,2 @@ +upload_channels: + - sfe1ed40 diff --git a/pull_request_template.md b/pull_request_template.md deleted file mode 100644 index 2bddf19..0000000 --- a/pull_request_template.md +++ /dev/null @@ -1,15 +0,0 @@ -{package} {version} {:snowflake:} - -**Destination channel:** {Snowflake | defaults} - -### Links - -- [{ticket_number}]() -- [Upstream repository]() -- [Upstream changelog/diff]() -- Relevant dependency PRs: - - ... - -### Explanation of changes: - -- ... diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 9018614..c6128f6 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -1,45 +1,154 @@ -{% set name = "" %} -{% set version = "" %} +{% set name = "recbole" %} +{% set version = "1.2.0" %} package: name: {{ name|lower }} version: {{ version }} source: - url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz - sha256: + - url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/recbole-{{ version }}.tar.gz + sha256: 132a8a706462b26bed82d409b67fbc09e90b3a49b607c7ba76c2f1718d8ddc17 + patches: + - patches/0001-update-colorlog-pinning.patch + - patches/0002-update-randomstate-to-default_rng-for-hyperopt.patch + # use github release archive for tests + - url: https://github.com/RUCAIBox/RecBole/archive/refs/tags/v{{ version }}.tar.gz + sha256: 1bc77a567083884b41ddd652b9b35078a0c3554c39ca38ab825ab2681eef138e + folder: gh_src build: number: 0 + # s390x: kmeans-pytorch (numba) unavailable + # py>=312: ray unavailable + skip: True # [py<38 or py>311 or s390x] script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation - skip: True # [py<38] requirements: + build: + - patch # [not win] + - m2-patch # [win] host: - python - pip + - setuptools + - wheel run: - python + - pytorch >=1.10.0 + - numpy >=1.17.2 + # Introduced upper pinning for scipy because of + # https://github.com/RUCAIBox/RecBole/issues/2034 + # https://github.com/RUCAIBox/RecBole/issues/2090 + # similar to any other like + # https://github.com/mmaelicke/scikit-gstat/issues/178 + # it can be removed when issues are closed. + - scipy >=1.6.0,<1.13.0a0 + - pandas >=1.3.0 + - tqdm >=4.48.2 + # colorlog pinning relaxed to lower bound instead of exact + # (we have more recent version and it seems to work). + - colorlog >=4.7.2 + - colorama 0.4.4 + - scikit-learn >=0.23.2 + - pyyaml >=5.1.0 + - tensorboard >=2.5.0 + - thop >=0.1.1.post2207130030 + - tabulate >=0.8.10 + - plotly >=4.0.0 + - texttable >=0.9.0 + - psutil >=5.9.0 + # ray-tune is needed: + # https://github.com/RUCAIBox/RecBole/blob/v1.2.0/recbole/quick_start/quick_start.py#L20 + # https://github.com/RUCAIBox/RecBole/blob/v1.2.0/conda/meta.yaml#L44 + - ray-tune >=1.13.0,<=2.6.3 + run_constrained: + # originally ==0.2.5 adapted with a patch + # to work with the more recent version we + # have (0.2.7) + - hyperopt >=0.2.5 + +# skip tests KGIN and MCCLK recommenders (they use +# torch-scatter, optional and unavailable) +{% set tests_to_skip = "test_kgin" %} +{% set tests_to_skip = tests_to_skip + " or test_mcclk" %} +# skip tests KGAT recommenders (they use dgl, optional and unavailable) +{% set tests_to_skip = tests_to_skip + " or test_kgat" %} +# faiss-cpu not available for some MKL issue for py 3.8 on osx-64 +# https://github.com/AnacondaRecipes/faiss-split-feedstock/blob/main/recipe/meta.yaml#L112 +# also, this problem occurs for osx-64 on "from . import _swigfaiss" then "_mkl_blas_caxpy" +# is not found: +# https://github.com/facebookresearch/faiss/issues/1755 +# https://discourse.cmake.org/t/mkl-64lp-versus-64ilp-difficulties/1223 +{% set tests_to_skip = tests_to_skip + " or test_NCL" %} # [osx and x86_64] +{% set tests_to_skip = tests_to_skip + " or TestSequentialRecommender" %} # [osx or (linux and aarch64)] + test: imports: - - {{ name.replace('-', '.') }} + - recbole requires: - pip + - pytest + - hyperopt + # The following dependencies are specified in the CI + # and they are optional. + # We contacted the upstream authors and they seem optional: + # https://github.com/RUCAIBox/RecBole/issues/2105#issuecomment-2559262386 + # Most of the recommenders are available optionally + # except KGAT (missing 'dgl'), KGIN, and MCCLK (missing + # 'torch-scatter'). + # https://github.com/RUCAIBox/RecBole/blob/v1.2.0/.github/workflows/python-package.yml#L36-L51 + - kmeans-pytorch + - xgboost + - lightgbm + - faiss-cpu + - networkx + - protobuf #3.19.0 + source_files: + - gh_src/run_recbole.py + - gh_src/tests commands: - pip check + - cd gh_src + # Smoke test from the CI + # https://github.com/RUCAIBox/RecBole/blob/v1.2.0/.github/workflows/python-package.yml#L55 + - python run_recbole.py --model=BPR --epochs=2 + # Tests run as specified in run_test.sh + # https://github.com/RUCAIBox/RecBole/blob/v1.2.0/run_test.sh#L7C1-L7C48 + # "python -m pytest" is used instead of "pytest" + # As suggested in + # https://github.com/RUCAIBox/RecBole/blob/v1.2.0/.github/workflows/python-package.yml#L52 + - python -m pytest -vv tests/config/test_config.py + - python -m pytest -vv tests/config/test_overall.py + # config tests + - python tests/config/test_command_line.py --use_gpu=False --valid_metric=Recall@10 --metrics="['Recall']" --epochs=200 --learning_rate=0.3 + # evaluation_setting tests + - python -m pytest -vv tests/evaluation_setting + # model tests + - python -m pytest -vv tests/model/test_model_auto.py -k "not ({{ tests_to_skip }})" + # disabled: requires manual intervention + # - python -m pytest -vv tests/model/test_model_manual.py + # data tests + - python -m pytest -vv tests/data/test_dataset.py + - python -m pytest -vv tests/data/test_dataloader.py + # hyper_tuning tests + - python -m pytest -vv tests/hyper_tuning/test_hyper_tuning.py about: - home: - summary: + home: https://recbole.io + summary: A unified, comprehensive and efficient recommendation library + license: MIT + license_family: MIT + license_file: LICENSE description: | - - license: - license_family: - license_file: - dev_url: - doc_url: + RecBole is developed based on Python and PyTorch for reproducing and developing + recommendation algorithms in a unified, comprehensive and efficient framework + for research purpose. In the first version, our library includes 53 recommendation + algorithms, covering four major categories: General Recommendation, Sequential + Recommendation, Context-aware Recommendation and Knowledge-based Recommendation. + doc_url: https://recbole.io/docs + dev_url: https://github.com/RUCAIBox/RecBole extra: recipe-maintainers: - - Jrice1317 + - lorepirri diff --git a/recipe/patches/0001-update-colorlog-pinning.patch b/recipe/patches/0001-update-colorlog-pinning.patch new file mode 100644 index 0000000..9d9749d --- /dev/null +++ b/recipe/patches/0001-update-colorlog-pinning.patch @@ -0,0 +1,25 @@ +From dc6746147b2d24edb5b0049698facea040c55186 Mon Sep 17 00:00:00 2001 +From: Lorenzo Pirritano +Date: Fri, 1 Nov 2024 11:16:58 +0100 +Subject: [PATCH 1/2] update colorlog pinning + +--- + setup.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index 9fa8cba..8c1334b 100644 +--- a/setup.py ++++ b/setup.py +@@ -12,7 +12,7 @@ install_requires = [ + "scipy>=1.6.0", + "pandas>=1.4.0", + "tqdm>=4.48.2", +- "colorlog==4.7.2", ++ "colorlog>=4.7.2", + "colorama==0.4.4", + "scikit_learn>=0.23.2", + "pyyaml>=5.1.0", +-- +2.39.1 + diff --git a/recipe/patches/0002-update-randomstate-to-default_rng-for-hyperopt.patch b/recipe/patches/0002-update-randomstate-to-default_rng-for-hyperopt.patch new file mode 100644 index 0000000..cfbcda9 --- /dev/null +++ b/recipe/patches/0002-update-randomstate-to-default_rng-for-hyperopt.patch @@ -0,0 +1,35 @@ +From 609847dbc848e8d8f9babc3534e34dc74d6d78b1 Mon Sep 17 00:00:00 2001 +From: Lorenzo Pirritano +Date: Fri, 1 Nov 2024 16:06:00 +0100 +Subject: [PATCH 2/2] update RandomState to default_rng for hyperopt + +NB this patch file must have CRLF line endings because the source file + that patches has CRLF line endings. This is achieved in .gitattributes + +Fixes: +'numpy.random.mtrand.RandomState' object has no attribute 'integers' + +For using new hyperopt 0.2.7 rather than the one set by upstream 0.2.5. + +See: https://github.com/hyperopt/hyperopt/issues/838 + +--- + recbole/trainer/hyper_tuning.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/recbole/trainer/hyper_tuning.py b/recbole/trainer/hyper_tuning.py +index ee1cfd6..cad9a65 100644 +--- a/recbole/trainer/hyper_tuning.py ++++ b/recbole/trainer/hyper_tuning.py +@@ -113,7 +113,7 @@ def exhaustive_search(new_ids, domain, trials, seed, nbMaxSucessiveFailures=1000 + ] + ) + +- rng = np.random.RandomState(seed) ++ rng = np.random.default_rng(seed) + rval = [] + for _, new_id in enumerate(new_ids): + newSample = False +-- +2.39.1 +