Merge pull request #208847 from samuela/samuela/nocturne

python3Packages.nocturne: init at unstable-2022-10-15
This commit is contained in:
Samuel Ainsworth 2023-01-08 21:52:47 -05:00 committed by GitHub
commit cfd1f0afc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 99 additions and 4 deletions

View File

@ -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; {

View File

@ -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 ];
};
}

View File

@ -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),
)

View File

@ -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; {

View File

@ -224,6 +224,7 @@ mapAliases ({
unittest2 = throw "unittest2 has been removed as it's a backport of unittest that's unmaintained and not needed beyond Python 3.4."; # added 2022-12-01
uproot3 = throw "uproot3 has been removed, use uproot instead"; # added 2022-12-13
uproot3-methods = throw "uproot3-methods has been removed"; # added 2022-12-13
virtual-display = throw "virtual-display has been renamed to PyVirtualDisplay"; # added 2023-01-07
Wand = wand; # added 2022-11-13
WazeRouteCalculator = wazeroutecalculator; # added 2021-09-29
weakrefmethod = throw "weakrefmethod was removed since it's not needed in Python >= 3.4"; # added 2022-12-01

View File

@ -6289,6 +6289,8 @@ self: super: with self; {
nocaselist = callPackage ../development/python-modules/nocaselist { };
nocturne = callPackage ../development/python-modules/nocturne { };
nodeenv = callPackage ../development/python-modules/nodeenv { };
nodepy-runtime = callPackage ../development/python-modules/nodepy-runtime { };
@ -9460,6 +9462,8 @@ self: super: with self; {
pyvicare = callPackage ../development/python-modules/pyvicare { };
PyVirtualDisplay = callPackage ../development/python-modules/PyVirtualDisplay { };
pyvis = callPackage ../development/python-modules/pyvis { };
pyvisa = callPackage ../development/python-modules/pyvisa { };
@ -11858,8 +11862,6 @@ self: super: with self; {
virtkey = callPackage ../development/python-modules/virtkey { };
virtual-display = callPackage ../development/python-modules/virtual-display { };
virtualenv = callPackage ../development/python-modules/virtualenv { };
virtualenv-clone = callPackage ../development/python-modules/virtualenv-clone { };