From e4bee97bdd8b6a7bf40436b861a01d85261c2210 Mon Sep 17 00:00:00 2001 From: natsukium Date: Wed, 17 May 2023 22:04:28 +0900 Subject: [PATCH 1/2] python3Packages.google-search-results: init at 2.4.2 --- .../google-search-results/default.nix | 39 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 41 insertions(+) create mode 100644 pkgs/development/python-modules/google-search-results/default.nix diff --git a/pkgs/development/python-modules/google-search-results/default.nix b/pkgs/development/python-modules/google-search-results/default.nix new file mode 100644 index 00000000000..9130ad9ddb0 --- /dev/null +++ b/pkgs/development/python-modules/google-search-results/default.nix @@ -0,0 +1,39 @@ +{ lib +, buildPythonPackage +, fetchPypi +, pythonOlder +, requests +}: + +buildPythonPackage rec { + pname = "google-search-results"; + version = "2.4.2"; + format = "setuptools"; + + disabled = pythonOlder "3.7"; + + src = fetchPypi { + inherit version; + pname = builtins.replaceStrings [ "-" ] [ "_" ] pname; + hash = "sha256-YDow7K4q+OYAsiY1dXpt8nXa1Lk0+XXmeHjM1kC3gkU="; + }; + + propagatedBuildInputs = [ + requests + ]; + + # almost all tests require an API key or network access + doCheck = false; + + pythonImportsCheck = [ + "serpapi" + ]; + + meta = with lib; { + description = "Scrape and search localized results from Google, Bing, Baidu, Yahoo, Yandex, Ebay, Homedepot, youtube at scale using SerpApi.com"; + homepage = "https://github.com/serpapi/google-search-results-python"; + changelog = "https://github.com/serpapi/google-search-results-python/releases/tag/${version}"; + license = licenses.mit; + maintainers = with maintainers; [ natsukium ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index a5466c5504e..f5b15d31c41 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4206,6 +4206,8 @@ self: super: with self; { google-resumable-media = callPackage ../development/python-modules/google-resumable-media { }; + google-search-results = callPackage ../development/python-modules/google-search-results { }; + googletrans = callPackage ../development/python-modules/googletrans { }; gorilla = callPackage ../development/python-modules/gorilla { }; From 65dfad9a5bf8c82866531bfe8057e84a9cf33d27 Mon Sep 17 00:00:00 2001 From: natsukium Date: Wed, 17 May 2023 22:14:41 +0900 Subject: [PATCH 2/2] python3Packages.langchain: enable google-search-results --- pkgs/development/python-modules/langchain/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/langchain/default.nix b/pkgs/development/python-modules/langchain/default.nix index aef55452294..4ff8f55bfc0 100644 --- a/pkgs/development/python-modules/langchain/default.nix +++ b/pkgs/development/python-modules/langchain/default.nix @@ -31,6 +31,7 @@ , azure-core , elasticsearch , opensearch-py +, google-search-results , faiss , spacy , nltk @@ -147,7 +148,7 @@ buildPythonPackage rec { manifest-ml elasticsearch opensearch-py - # google-search-results + google-search-results faiss sentence-transformers transformers