diff --git a/pkgs/development/python-modules/elastic-transport/default.nix b/pkgs/development/python-modules/elastic-transport/default.nix new file mode 100644 index 000000000000..0c0ba62ce3a2 --- /dev/null +++ b/pkgs/development/python-modules/elastic-transport/default.nix @@ -0,0 +1,72 @@ +{ lib +, aiohttp +, buildPythonPackage +, certifi +, fetchFromGitHub +, mock +, pytest-asyncio +, pytest-httpserver +, pytestCheckHook +, pythonOlder +, requests +, trustme +, urllib3 +}: + +buildPythonPackage rec { + pname = "elastic-transport"; + version = "8.4.0"; + format = "setuptools"; + + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "elastic"; + repo = "elastic-transport-python"; + rev = "refs/tags/v${version}"; + hash = "sha256-rZdl2gjY5Yg2Ls777tj12pPATMn//xVvEM4wkrZ3qUY="; + }; + + postPatch = '' + substituteInPlace setup.cfg \ + --replace " --cov-report=term-missing --cov=elastic_transport" "" + ''; + + propagatedBuildInputs = [ + urllib3 + certifi + ]; + + nativeCheckInputs = [ + aiohttp + mock + pytest-asyncio + pytest-httpserver + pytestCheckHook + requests + trustme + ]; + + pythonImportsCheck = [ + "elastic_transport" + ]; + + disabledTests = [ + # Tests require network access + "fingerprint" + "ssl" + "test_custom_headers" + "test_custom_user_agent" + "test_default_headers" + "test_head" + "tls" + ]; + + meta = with lib; { + description = "Transport classes and utilities shared among Python Elastic client libraries"; + homepage = "https://github.com/elasticsearch/elastic-transport-python"; + changelog = "https://github.com/elastic/elastic-transport-python/releases/tag/v${version}"; + license = licenses.asl20; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/development/python-modules/elasticsearch/default.nix b/pkgs/development/python-modules/elasticsearch/default.nix index 33e91ebc22c1..b8c25ce5ac31 100644 --- a/pkgs/development/python-modules/elasticsearch/default.nix +++ b/pkgs/development/python-modules/elasticsearch/default.nix @@ -23,6 +23,7 @@ buildPythonPackage (rec { meta = with lib; { description = "Official low-level client for Elasticsearch"; homepage = "https://github.com/elasticsearch/elasticsearch-py"; + changelog = "https://github.com/elastic/elasticsearch-py/releases/tag/v${version}"; license = licenses.asl20; maintainers = with maintainers; [ desiderius ]; }; diff --git a/pkgs/development/python-modules/elasticsearch8/default.nix b/pkgs/development/python-modules/elasticsearch8/default.nix new file mode 100644 index 000000000000..ead2f6b07ee6 --- /dev/null +++ b/pkgs/development/python-modules/elasticsearch8/default.nix @@ -0,0 +1,52 @@ +{ lib +, aiohttp +, buildPythonPackage +, elastic-transport +, fetchPypi +, pythonOlder +, requests +, urllib3 +}: + +buildPythonPackage rec { + pname = "elasticsearch8"; + version = "8.7.0"; + format = "setuptools"; + + disabled = pythonOlder "3.7"; + + src = fetchPypi { + inherit pname version; + hash = "sha256-mRy48OYsm+0M1/D+abs83RiqN8wQr/Z6SZUY4TNg190="; + }; + + nativeBuildInputs = [ + elastic-transport + ]; + + propagatedBuildInputs = [ + requests + ]; + + passthru.optional-dependencies = { + async = [ + aiohttp + ]; + }; + + # Check is disabled because running them destroy the content of the local cluster! + # https://github.com/elasticsearch/elasticsearch-py/tree/main/test_elasticsearch + doCheck = false; + + pythonImportsCheck = [ + "elasticsearch8" + ]; + + meta = with lib; { + description = "Official low-level client for Elasticsearch"; + homepage = "https://github.com/elasticsearch/elasticsearch-py"; + changelog = "https://github.com/elastic/elasticsearch-py/releases/tag/v${version}"; + license = licenses.asl20; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/development/python-modules/es-client/default.nix b/pkgs/development/python-modules/es-client/default.nix new file mode 100644 index 000000000000..5e43edc6da6b --- /dev/null +++ b/pkgs/development/python-modules/es-client/default.nix @@ -0,0 +1,74 @@ +{ lib +, buildPythonPackage +, certifi +, click +, elastic-transport +, elasticsearch8 +, fetchFromGitHub +, hatchling +, mock +, pytest-asyncio +, pytestCheckHook +, pythonOlder +, pyyaml +, requests +, six +, voluptuous +}: + +buildPythonPackage rec { + pname = "es-client"; + version = "8.7.0"; + format = "pyproject"; + + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "untergeek"; + repo = "es_client"; + rev = "refs/tags/v${version}"; + hash = "sha256-DJIo0yFJGR9gw5UJnmgnBFZx0uXUEW3rWT49jhfnXkQ="; + }; + + nativeBuildInputs = [ + hatchling + ]; + + propagatedBuildInputs = [ + certifi + click + elastic-transport + elasticsearch8 + pyyaml + six + voluptuous + ]; + + nativeCheckInputs = [ + mock + pytest-asyncio + pytestCheckHook + requests + ]; + + pythonImportsCheck = [ + "es_client" + ]; + + disabledTests = [ + # Tests require network access + "test_bad_version_raises" + "test_client_info" + "test_multiple_hosts_raises" + "test_non_dict_passed" + "test_skip_version_check" + ]; + + meta = with lib; { + description = "Module for building Elasticsearch client objects"; + homepage = "https://github.com/untergeek/es_client"; + changelog = "https://github.com/untergeek/es_client/releases/tag/v${version}"; + license = licenses.asl20; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index d4bb65978a7d..84e43292b3f8 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3086,8 +3086,12 @@ self: super: with self; { elastic-apm = callPackage ../development/python-modules/elastic-apm { }; + elastic-transport = callPackage ../development/python-modules/elastic-transport { }; + elasticsearch = callPackage ../development/python-modules/elasticsearch { }; + elasticsearch8 = callPackage ../development/python-modules/elasticsearch8 { }; + elasticsearch-dsl = callPackage ../development/python-modules/elasticsearch-dsl { }; elasticsearchdsl = self.elasticsearch-dsl; @@ -3192,6 +3196,8 @@ self: super: with self; { eradicate = callPackage ../development/python-modules/eradicate { }; + es-client = callPackage ../development/python-modules/es-client { }; + espeak-phonemizer = callPackage ../development/python-modules/espeak-phonemizer { }; esphome-dashboard-api = callPackage ../development/python-modules/esphome-dashboard-api { };