about summary refs log tree commit diff
path: root/pkgs/development/python-modules
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2023-01-09 06:01:08 +0000
committerGitHub <noreply@github.com>2023-01-09 06:01:08 +0000
commit99dd0da8dc6177990d4d2c149baf92f7fed49703 (patch)
treefc6e26a4fc50b55b513e2e323d1e4a57002301bd /pkgs/development/python-modules
parent55fbb9e25789204ffe7460443cbb366b81adee11 (diff)
parent21b9c3cee5fa202659c07ca0071706f4ea2f14df (diff)
Merge master into staging-next
Diffstat (limited to 'pkgs/development/python-modules')
-rw-r--r--pkgs/development/python-modules/PyVirtualDisplay/default.nix (renamed from pkgs/development/python-modules/virtual-display/default.nix)0
-rw-r--r--pkgs/development/python-modules/hydra-core/default.nix4
-rw-r--r--pkgs/development/python-modules/nocturne/default.nix61
-rw-r--r--pkgs/development/python-modules/nocturne/dependencies.patch27
-rw-r--r--pkgs/development/python-modules/pytest-xvfb/default.nix4
-rw-r--r--pkgs/development/python-modules/thefuzz/default.nix50
6 files changed, 144 insertions, 2 deletions
diff --git a/pkgs/development/python-modules/virtual-display/default.nix b/pkgs/development/python-modules/PyVirtualDisplay/default.nix
index bc7469e1d61a0..bc7469e1d61a0 100644
--- a/pkgs/development/python-modules/virtual-display/default.nix
+++ b/pkgs/development/python-modules/PyVirtualDisplay/default.nix
diff --git a/pkgs/development/python-modules/hydra-core/default.nix b/pkgs/development/python-modules/hydra-core/default.nix
index 17dda8404b4ad..d16b1137312c5 100644
--- a/pkgs/development/python-modules/hydra-core/default.nix
+++ b/pkgs/development/python-modules/hydra-core/default.nix
@@ -7,6 +7,7 @@
 , importlib-resources
 , jre_headless
 , omegaconf
+, packaging
 , pytestCheckHook
 , pythonOlder
 , substituteAll
@@ -48,6 +49,7 @@ buildPythonPackage rec {
   propagatedBuildInputs = [
     antlr4-python3-runtime
     omegaconf
+    packaging
   ] ++ lib.optionals (pythonOlder "3.9") [
     importlib-resources
   ];
@@ -69,6 +71,8 @@ buildPythonPackage rec {
 
   pythonImportsCheck = [
     "hydra"
+    # See https://github.com/NixOS/nixpkgs/issues/208843
+    "hydra.version"
   ];
 
   meta = with lib; {
diff --git a/pkgs/development/python-modules/nocturne/default.nix b/pkgs/development/python-modules/nocturne/default.nix
new file mode 100644
index 0000000000000..42424f1dacc97
--- /dev/null
+++ b/pkgs/development/python-modules/nocturne/default.nix
@@ -0,0 +1,61 @@
+{ buildPythonPackage
+, cmake
+, fetchFromGitHub
+, gtest
+, hydra-core
+, lib
+, nlohmann_json
+, pybind11
+, PyVirtualDisplay
+, sfml
+, substituteAll
+}:
+
+buildPythonPackage rec {
+  pname = "nocturne";
+  version = "unstable-2022-10-15";
+  format = "setuptools";
+
+  src = fetchFromGitHub {
+    owner = "facebookresearch";
+    repo = pname;
+    rev = "ae0a4e361457caf6b7e397675cc86f46161405ed";
+    hash = "sha256-pFVbl4m7qX1mJgleNabRboS9klDDsbzUa4PYL5+Jupc=";
+  };
+
+  # Simulate the git submodules but with nixpkgs dependencies
+  postUnpack = ''
+    rm -rf $sourceRoot/third_party/*
+    ln -s ${nlohmann_json.src} $sourceRoot/third_party/json
+    ln -s ${pybind11.src} $sourceRoot/third_party/pybind11
+  '';
+
+  patches = [
+    (substituteAll {
+      src = ./dependencies.patch;
+      gtest_src = gtest.src;
+    })
+  ];
+
+  nativeBuildInputs = [ cmake ];
+  dontUseCmakeConfigure = true;
+
+  buildInputs = [ sfml ];
+
+  # hydra-core and PyVirtualDisplay are not declared as dependences but they are requirements
+  propagatedBuildInputs = [ hydra-core PyVirtualDisplay ];
+
+  # Test suite requires hydra-submitit-launcher which is not packaged as of 2022-01-02
+  doCheck = false;
+
+  pythonImportsCheck = [
+    "nocturne"
+  ];
+
+  meta = with lib; {
+    description = "A data-driven, fast driving simulator for multi-agent coordination under partial observability";
+    homepage = "https://github.com/facebookresearch/nocturne";
+    license = licenses.mit;
+    maintainers = with maintainers; [ samuela ];
+  };
+}
diff --git a/pkgs/development/python-modules/nocturne/dependencies.patch b/pkgs/development/python-modules/nocturne/dependencies.patch
new file mode 100644
index 0000000000000..18843ff6309f3
--- /dev/null
+++ b/pkgs/development/python-modules/nocturne/dependencies.patch
@@ -0,0 +1,27 @@
+diff --git a/nocturne/cpp/CMakeLists.txt b/nocturne/cpp/CMakeLists.txt
+index c67815f..e1f825b 100644
+--- a/nocturne/cpp/CMakeLists.txt
++++ b/nocturne/cpp/CMakeLists.txt
+@@ -62,8 +62,7 @@ include(FetchContent)
+ 
+ FetchContent_Declare(
+   googletest
+-  GIT_REPOSITORY https://github.com/google/googletest.git
+-  GIT_TAG main
++  SOURCE_DIR @gtest_src@
+ )
+ 
+ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
+diff --git a/setup.py b/setup.py
+index 4863ae6..b5d3545 100644
+--- a/setup.py
++++ b/setup.py
+@@ -92,6 +92,8 @@ def main():
+     # with open("./requirements.txt", "r") as f:
+     #     requires = f.read().splitlines()
+     setup(
++        # Adding `packages=` is necessary to get `python setup.py install` to work
++        packages=["nocturne", "cfgs"],
+         ext_modules=[CMakeExtension("nocturne", "./nocturne")],
+         cmdclass=dict(build_ext=CMakeBuild),
+     )
diff --git a/pkgs/development/python-modules/pytest-xvfb/default.nix b/pkgs/development/python-modules/pytest-xvfb/default.nix
index c3dabe7f6e30a..f4038c557797b 100644
--- a/pkgs/development/python-modules/pytest-xvfb/default.nix
+++ b/pkgs/development/python-modules/pytest-xvfb/default.nix
@@ -2,7 +2,7 @@
 , buildPythonPackage
 , fetchPypi
 , pytest
-, virtual-display
+, PyVirtualDisplay
 , isPy27
 }:
 
@@ -19,7 +19,7 @@ buildPythonPackage rec {
   buildInputs = [ pytest ];
 
   propagatedBuildInputs = [
-    virtual-display
+    PyVirtualDisplay
   ];
 
   meta = with lib; {
diff --git a/pkgs/development/python-modules/thefuzz/default.nix b/pkgs/development/python-modules/thefuzz/default.nix
new file mode 100644
index 0000000000000..e521182a395a4
--- /dev/null
+++ b/pkgs/development/python-modules/thefuzz/default.nix
@@ -0,0 +1,50 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, pythonOlder
+, pytestCheckHook
+, hypothesis
+, python-Levenshtein
+}:
+
+buildPythonPackage rec {
+  pname = "thefuzz";
+  version = "0.19.0";
+  format = "setuptools";
+
+  disabled = pythonOlder "3.7";
+
+  src = fetchPypi {
+    inherit pname version;
+    hash = "sha256-b3Em2y8silQhKwXjp0DkX0KRxJfXXSB1Fyj2Nbt0qj0=";
+  };
+
+  propagatedBuildInputs = [ python-Levenshtein ];
+
+  # Skip linting
+  postPatch = ''
+    substituteInPlace test_thefuzz.py --replace "import pycodestyle" ""
+  '';
+
+  pythonImportsCheck = [
+    "thefuzz"
+  ];
+
+  checkInputs = [
+    hypothesis
+    pytestCheckHook
+  ];
+
+  disabledTests = [
+    # Skip linting
+    "test_pep8_conformance"
+  ];
+
+  meta = with lib; {
+    description = "Fuzzy string matching for Python";
+    homepage = "https://github.com/seatgeek/thefuzz";
+    changelog = "https://github.com/seatgeek/thefuzz/blob/${version}/CHANGES.rst";
+    license = licenses.gpl2Only;
+    maintainers = with maintainers; [ sumnerevans ];
+  };
+}