mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-10 23:33:47 +00:00
narwhals does not build on staging-next: a test checking for a specific error message fails, because that error message has changed (likely triggered by the polars upgrade to 1.40.1). Apply upstream's fix, and apply two previous test fixes to get that last commit to apply. The other two commits update warnings ignored by the tests. This makes the tests pass, but I have not further tested the result. Bumping narwhals to at least 2.20.0 may be a better fix.
128 lines
3.4 KiB
Nix
128 lines
3.4 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
buildPythonPackage,
|
|
dask,
|
|
duckdb,
|
|
fetchFromGitHub,
|
|
fetchpatch2,
|
|
hatchling,
|
|
hypothesis,
|
|
ibis-framework,
|
|
packaging,
|
|
pandas,
|
|
polars,
|
|
pyarrow-hotfix,
|
|
pyarrow,
|
|
pyspark,
|
|
pytest-env,
|
|
pytestCheckHook,
|
|
rich,
|
|
sqlframe,
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "narwhals";
|
|
version = "2.16.0";
|
|
pyproject = true;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "narwhals-dev";
|
|
repo = "narwhals";
|
|
tag = "v${version}";
|
|
hash = "sha256-k7CeM8Q4JgKbkLisAaVrljro4diOf0K0immek6AI0vM=";
|
|
};
|
|
|
|
patches = [
|
|
(fetchpatch2 {
|
|
name = "fix-dask-deprecationwarning.patch";
|
|
url = "https://github.com/narwhals-dev/narwhals/commit/254655af21872e8127f7fee9a9afbfb279f1eda2.patch?full_index=1";
|
|
# Exclude unrelated change to non-test code.
|
|
includes = [ "pyproject.toml" ];
|
|
hash = "sha256-tgz0b08P36CENOYFBILbicHhdB4BytXgFQk3nIxpw0A=";
|
|
})
|
|
(fetchpatch2 {
|
|
name = "fix-dask-deprecationwarning.patch";
|
|
url = "https://github.com/narwhals-dev/narwhals/commit/b92d5a840e08bdf7806947ffde27de856900c5ab.patch?full_index=1";
|
|
hash = "sha256-2lct6/MfViKnRjpEehNKqF6zdZVIkXi7tYxycDh/Hn8=";
|
|
})
|
|
(fetchpatch2 {
|
|
name = "ignore-polars-deprecation-warning-in-tests.patch";
|
|
url = "https://github.com/narwhals-dev/narwhals/commit/fb798716eb5f8835096d8f88d422baae2b22b3ce.patch?full_index=1";
|
|
hash = "sha256-pWi0y4S48aADJ1MA3kB9FsLuoA+HfZp5+AgEn69pUuA=";
|
|
})
|
|
];
|
|
|
|
build-system = [ hatchling ];
|
|
|
|
optional-dependencies = {
|
|
# cudf = [ cudf ];
|
|
dask = [ dask ] ++ dask.optional-dependencies.dataframe;
|
|
# modin = [ modin ];
|
|
pandas = [ pandas ];
|
|
polars = [ polars ];
|
|
pyarrow = [ pyarrow ];
|
|
pyspark = [ pyspark ];
|
|
ibis = [
|
|
ibis-framework
|
|
rich
|
|
packaging
|
|
pyarrow-hotfix
|
|
];
|
|
sqlframe = [ sqlframe ];
|
|
};
|
|
|
|
nativeCheckInputs = [
|
|
duckdb
|
|
hypothesis
|
|
pytest-env
|
|
pytestCheckHook
|
|
]
|
|
++ lib.concatAttrValues optional-dependencies;
|
|
|
|
pythonImportsCheck = [ "narwhals" ];
|
|
|
|
disabledTests = [
|
|
# Flaky
|
|
"test_rolling_var_hypothesis"
|
|
# Missing file
|
|
"test_pyspark_connect_deps_2517"
|
|
# Timezone issue
|
|
"test_to_datetime"
|
|
"test_unary_two_elements"
|
|
# Test requires pyspark binary
|
|
"test_datetime_w_tz_pyspark"
|
|
"test_convert_time_zone_to_connection_tz_pyspark"
|
|
"test_replace_time_zone_to_connection_tz_pyspark"
|
|
"test_lazy"
|
|
# Incompatible with ibis 11
|
|
"test_unique_3069"
|
|
# DuckDB 1.4.x compatibility - empty result schema handling with PyArrow
|
|
"test_skew_expr"
|
|
# ibis improvements cause strict XPASS failures (tests expected to fail now pass)
|
|
"test_empty_scalar_reduction_with_columns"
|
|
"test_collect_empty"
|
|
"test_first_last_expr_over_order_by"
|
|
"test_first_expr_broadcasting"
|
|
# sqlframe improvements cause strict XPASS failures (tests expected to fail now pass)
|
|
"test_unique_expr"
|
|
];
|
|
|
|
disabledTestPaths = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
|
|
# Segfault in included polars/lazyframe
|
|
"tests/tpch_q1_test.py"
|
|
];
|
|
|
|
pytestFlags = [
|
|
"-Wignore::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/${src.tag}";
|
|
license = lib.licenses.mit;
|
|
maintainers = with lib.maintainers; [ fab ];
|
|
};
|
|
}
|