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.4.1";
26 pyproject = true;
27
28 disabled = pythonOlder "3.8";
29
30 src = fetchFromGitHub {
31 owner = "altair-viz";
32 repo = "altair";
33 rev = "refs/tags/v${version}";
34 hash = "sha256-7C51ACaBuNtOSXqLpuCI5bnLyE9U64vNXlD4/msPq2k=";
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 ];
64
65 disabledTestPaths = [
66 # Disabled because it requires internet connectivity
67 "tests/test_examples.py"
68 # TODO: Disabled because of missing altair_viewer package
69 "tests/vegalite/v5/test_api.py"
70 # avoid updating files and dependency on black
71 "tests/test_toplevel.py"
72 # require vl-convert package
73 "tests/utils/test_compiler.py"
74 ];
75
76 meta = with lib; {
77 description = "Declarative statistical visualization library for Python";
78 homepage = "https://altair-viz.github.io";
79 downloadPage = "https://github.com/altair-viz/altair";
80 changelog = "https://altair-viz.github.io/releases/changes.html";
81 license = licenses.bsd3;
82 maintainers = with maintainers; [
83 teh
84 vinetos
85 ];
86 };
87}