From 6432b6e7a26edcde8f50d62fc5d4c8e4bde77af0 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Fri, 11 Oct 2024 20:58:46 +0200 Subject: [PATCH] python312Packages.narwhals: init at 1.9.1 Lightweight and extensible compatibility layer between dataframe libraries https://github.com/narwhals-dev/narwhals --- .../python-modules/narwhals/default.nix | 71 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 73 insertions(+) create mode 100644 pkgs/development/python-modules/narwhals/default.nix diff --git a/pkgs/development/python-modules/narwhals/default.nix b/pkgs/development/python-modules/narwhals/default.nix new file mode 100644 index 000000000000..52ef9d3ba733 --- /dev/null +++ b/pkgs/development/python-modules/narwhals/default.nix @@ -0,0 +1,71 @@ +{ + lib, + buildPythonPackage, + # cudf, + dask, + dask-expr, + duckdb, + fetchFromGitHub, + hatchling, + hypothesis, + # modin, + pandas, + polars, + pyarrow, + pytest-env, + pytestCheckHook, + pythonOlder, +}: + +buildPythonPackage rec { + pname = "narwhals"; + version = "1.9.1"; + pyproject = true; + + disabled = pythonOlder "3.8"; + + src = fetchFromGitHub { + owner = "narwhals-dev"; + repo = "narwhals"; + rev = "refs/tags/v${version}"; + hash = "sha256-KUtmkDaHPaJ917/hVhJrt+x64JJYm06fyDfCV2nSa3s="; + }; + + build-system = [ + hatchling + ]; + + optional-dependencies = { + # cudf = [ cudf ]; + dask = [ + dask + dask-expr + ]; + # modin = [ modin ]; + pandas = [ pandas ]; + polars = [ polars ]; + pyarrow = [ pyarrow ]; + }; + + nativeCheckInputs = [ + duckdb + hypothesis + pytest-env + pytestCheckHook + ] ++ lib.flatten (builtins.attrValues optional-dependencies); + + pythonImportsCheck = [ "narwhals" ]; + + pytestFlagsArray = [ + "-W" + "ignore::DeprecationWarning" + ]; + + meta = { + description = "Lightweight and extensible compatibility layer between dataframe libraries"; + homepage = "https://github.com/narwhals-dev/narwhals"; + changelog = "https://github.com/narwhals-dev/narwhals/releases/tag/v${version}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ fab ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 379f1368987f..547e0b6af13e 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8753,6 +8753,8 @@ self: super: with self; { navec = callPackage ../development/python-modules/navec { }; + narwhals = callPackage ../development/python-modules/narwhals { }; + natasha = callPackage ../development/python-modules/natasha { }; natural = callPackage ../development/python-modules/natural { };