1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 hatchling,
6 ipython,
7 ipywidgets,
8 jinja2,
9 jsonschema,
10 narwhals,
11 numpy,
12 packaging,
13 pandas,
14 polars,
15 pytest-xdist,
16 pytestCheckHook,
17 pythonOlder,
18 toolz,
19 typing-extensions,
20 vega-datasets,
21}:
22
23buildPythonPackage rec {
24 pname = "altair";
25 version = "5.5.0";
26 pyproject = true;
27
28 disabled = pythonOlder "3.9";
29
30 src = fetchFromGitHub {
31 owner = "altair-viz";
32 repo = "altair";
33 tag = "v${version}";
34 hash = "sha256-lrKC4FYRQEax5E0lQNhO9FLk5UOJ0TnYzqZjndlRpGI=";
35 };
36
37 build-system = [ hatchling ];
38
39 dependencies = [
40 jinja2
41 jsonschema
42 narwhals
43 numpy
44 packaging
45 pandas
46 toolz
47 ] ++ lib.optional (pythonOlder "3.14") typing-extensions;
48
49 nativeCheckInputs = [
50 ipython
51 ipywidgets
52 polars
53 pytest-xdist
54 pytestCheckHook
55 vega-datasets
56 ];
57
58 pythonImportsCheck = [ "altair" ];
59
60 disabledTests = [
61 # ValueError: Saving charts in 'svg' format requires the vl-convert-python or altair_saver package: see http://github.com/altair-viz/altair_saver/
62 "test_renderer_with_none_embed_options"
63 # Sometimes conflict due to parallelism
64 "test_dataframe_to_csv[polars]"
65 "test_dataframe_to_csv[pandas]"
66 # Network access
67 "test_theme_remote_lambda"
68 ];
69
70 disabledTestPaths = [
71 # Disabled because it requires internet connectivity
72 "tests/test_examples.py"
73 # TODO: Disabled because of missing altair_viewer package
74 "tests/vegalite/v5/test_api.py"
75 # avoid updating files and dependency on black
76 "tests/test_toplevel.py"
77 # require vl-convert package
78 "tests/utils/test_compiler.py"
79 ];
80
81 meta = with lib; {
82 description = "Declarative statistical visualization library for Python";
83 homepage = "https://altair-viz.github.io";
84 downloadPage = "https://github.com/altair-viz/altair";
85 changelog = "https://altair-viz.github.io/releases/changes.html";
86 license = licenses.bsd3;
87 maintainers = with maintainers; [
88 teh
89 vinetos
90 ];
91 };
92}