1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 hatchling,
8
9 # optional-dependencies
10 # cudf,
11 dask,
12 # modin,
13 pandas,
14 polars,
15 pyarrow,
16 pyspark,
17 sqlframe,
18
19 # tests
20 duckdb,
21 hypothesis,
22 pytest-env,
23 pytestCheckHook,
24}:
25
26buildPythonPackage rec {
27 pname = "narwhals";
28 version = "1.37.0";
29 pyproject = true;
30
31 src = fetchFromGitHub {
32 owner = "narwhals-dev";
33 repo = "narwhals";
34 tag = "v${version}";
35 hash = "sha256-AYgpHJwQVP+F2kr5YJtjnLNYedc81RvRcX1Cfh7c0xw=";
36 };
37
38 build-system = [
39 hatchling
40 ];
41
42 optional-dependencies = {
43 # cudf = [ cudf ];
44 dask = [
45 dask
46 ] ++ dask.optional-dependencies.dataframe;
47 # modin = [ modin ];
48 pandas = [ pandas ];
49 polars = [ polars ];
50 pyarrow = [ pyarrow ];
51 pyspark = [ pyspark ];
52 sqlframe = [ sqlframe ];
53 };
54
55 nativeCheckInputs = [
56 duckdb
57 hypothesis
58 pytest-env
59 pytestCheckHook
60 ] ++ lib.flatten (builtins.attrValues optional-dependencies);
61
62 pythonImportsCheck = [ "narwhals" ];
63
64 pytestFlagsArray = [
65 "-W"
66 "ignore::DeprecationWarning"
67 ];
68
69 meta = {
70 description = "Lightweight and extensible compatibility layer between dataframe libraries";
71 homepage = "https://github.com/narwhals-dev/narwhals";
72 changelog = "https://github.com/narwhals-dev/narwhals/releases/tag/${src.tag}";
73 license = lib.licenses.mit;
74 maintainers = with lib.maintainers; [ fab ];
75 };
76}