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