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