diff --git a/pkgs/development/python-modules/orjson/default.nix b/pkgs/development/python-modules/orjson/default.nix new file mode 100644 index 000000000000..55fbb2df8e25 --- /dev/null +++ b/pkgs/development/python-modules/orjson/default.nix @@ -0,0 +1,61 @@ +{ lib +, stdenv +, pythonOlder +, rustPlatform +, fetchFromGitHub +, buildPythonPackage +, libiconv +, numpy +, psutil +, pytestCheckHook +, python-dateutil +, pytz +, xxhash +}: + +buildPythonPackage rec { + pname = "orjson"; + version = "3.6.3"; + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "ijl"; + repo = pname; + rev = version; + sha256 = "10clf13bp3fqd9b7n1isrfwz7sngcl1j6birqc1xyg9wzfw1kslj"; + }; + + cargoDeps = rustPlatform.fetchCargoTarball { + inherit src; + name = "${pname}-${version}"; + sha256 = "163rf8k7qb1whjf78i8v5dlyif1sgvd9xkj8li81j45abgzkq86w"; + }; + + format = "pyproject"; + + nativeBuildInputs = with rustPlatform; [ + cargoSetupHook + maturinBuildHook + ]; + + buildInputs = lib.optionals stdenv.isDarwin [ libiconv ]; + + checkInputs = [ + numpy + psutil + pytestCheckHook + python-dateutil + pytz + xxhash + ]; + + pythonImportsCheck = [ pname ]; + + meta = with lib; { + description = "Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy"; + homepage = "https://github.com/ijl/orjson"; + license = with licenses; [ asl20 mit ]; + platforms = platforms.unix; + maintainers = with maintainers; [ misuzu ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 19ee538be2d8..8f6e567cf3be 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -5162,6 +5162,8 @@ in { orderedset = callPackage ../development/python-modules/orderedset { }; + orjson = callPackage ../development/python-modules/orjson { }; + orm = callPackage ../development/python-modules/orm { }; ortools = (toPythonModule (pkgs.or-tools.override { inherit (self) python; })).python;