about summary refs log tree commit diff
path: root/pkgs/development/python-modules/luqum
diff options
context:
space:
mode:
authorFabian Affolter <mail@fabian-affolter.ch>2023-12-01 12:57:19 +0100
committerFabian Affolter <mail@fabian-affolter.ch>2023-12-01 12:57:19 +0100
commit24362a60e99dc464c9fe9006021eee56a197dd54 (patch)
tree448ab7636b3532508f77338d44fa0c4fa50cf242 /pkgs/development/python-modules/luqum
parent604365c826de879261fece225683ed7331e218bc (diff)
python311Packages.luqum: refactor
Diffstat (limited to 'pkgs/development/python-modules/luqum')
-rw-r--r--pkgs/development/python-modules/luqum/default.nix45
1 files changed, 33 insertions, 12 deletions
diff --git a/pkgs/development/python-modules/luqum/default.nix b/pkgs/development/python-modules/luqum/default.nix
index 2c9f78fc583cb..afad9262c7b3b 100644
--- a/pkgs/development/python-modules/luqum/default.nix
+++ b/pkgs/development/python-modules/luqum/default.nix
@@ -1,40 +1,61 @@
 { lib
 , buildPythonPackage
+, elastic-transport
+, elasticsearch-dsl
 , fetchFromGitHub
-, pythonOlder
-# dependencies
 , ply
-# test dependencies
-, elasticsearch-dsl
+, pytestCheckHook
+, pythonOlder
+, setuptools
 }:
-let
+
+buildPythonPackage rec {
   pname = "luqum";
   version = "0.13.0";
-in
-buildPythonPackage {
-  inherit pname version;
-  format = "setuptools";
+  pyproject = true;
 
   disabled = pythonOlder "3.8";
 
   src = fetchFromGitHub {
     owner = "jurismarches";
-    repo = pname;
-    rev = version;
+    repo = "luqum";
+    rev = "refs/tags/${version}";
     hash = "sha256-lcJCLl0crCl3Y5UlWBMZJR2UtVP96gaJNRxwY9Xn7TM=";
   };
 
+  postPatch = ''
+    substituteInPlace pyproject.toml \
+      --replace '--doctest-modules --doctest-glob="test_*.rst" --cov=luqum --cov-branch --cov-report html --no-cov-on-fail' ""
+  '';
+
+  nativeBuildInputs = [
+    setuptools
+  ];
+
   propagatedBuildInputs = [
     ply
   ];
 
   nativeCheckInputs = [
+    elastic-transport
     elasticsearch-dsl
+    pytestCheckHook
+  ];
+
+  pythonImportsCheck = [
+    "luqum"
+  ];
+
+  disabledTestPaths = [
+    # Tests require an Elasticsearch instance
+    "tests/test_elasticsearch/test_es_integration.py"
+    "tests/test_elasticsearch/test_es_naming.py"
   ];
 
   meta = with lib; {
-    description = "A lucene query parser generating ElasticSearch queries and more !";
+    description = "A lucene query parser generating ElasticSearch queries";
     homepage = "https://github.com/jurismarches/luqum";
+    changelog = "https://github.com/jurismarches/luqum/releases/tag/${version}";
     license = licenses.asl20;
     maintainers = with maintainers; [ happysalada ];
   };