summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/altair/default.nix
blob: c5f26a64d1d4849f65ab4b2dbca761ed6fcff776 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pythonOlder,

  # build-system
  hatchling,

  # dependencies
  jinja2,
  jsonschema,
  narwhals,
  numpy,
  packaging,
  pandas,
  toolz,
  typing-extensions,

  # tests
  anywidget,
  ipython,
  ipywidgets,
  mistune,
  polars,
  pytest-xdist,
  pytestCheckHook,
  vega-datasets,
  vl-convert-python,
  writableTmpDirAsHomeHook,
}:

buildPythonPackage (finalAttrs: {
  pname = "altair";
  version = "6.0.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "altair-viz";
    repo = "altair";
    tag = "v${finalAttrs.version}";
    hash = "sha256-+Qc51L4tL1pRDpWwadxPpTE4tDH3FTO/wH67FtXMN7k=";
  };

  build-system = [ hatchling ];

  dependencies = [
    jinja2
    jsonschema
    narwhals
    numpy
    packaging
    pandas
    toolz
  ]
  ++ lib.optionals (pythonOlder "3.14") [
    typing-extensions
  ];

  nativeCheckInputs = [
    anywidget
    ipython
    ipywidgets
    mistune
    polars
    pytest-xdist
    pytestCheckHook
    vega-datasets
    vl-convert-python
    writableTmpDirAsHomeHook
  ];

  pythonImportsCheck = [ "altair" ];

  enabledTestPaths = [
    "tests/"
  ];

  disabledTests = [
    # ValueError: Saving charts in 'svg' format requires the vl-convert-python or altair_saver package: see http://github.com/altair-viz/altair_saver/
    "test_renderer_with_none_embed_options"

    # Sometimes conflict due to parallelism
    "test_dataframe_to_csv[polars]"
    "test_dataframe_to_csv[pandas]"

    # Network access
    "test_chart_validation_errors"
    "test_data_consistency"
    "test_load_call"
    "test_loader_call"
    "test_multiple_field_strings_in_condition"
    "test_no_remote_connection"
    "test_pandas_date_parse"
    "test_pandas_date_parse"
    "test_polars_date_read_json_roundtrip"
    "test_polars_date_read_json_roundtrip"
    "test_polars_date_read_json_roundtrip"
    "test_polars_date_read_json_roundtrip"
    "test_reader_cache"
    "test_theme_remote_lambda"
    "test_tsv"
  ];

  disabledTestPaths = [
    # Network access
    "altair/datasets/_data.py"
    "tests/test_examples.py"

    # avoid updating files and dependency on black
    "tests/test_toplevel.py"
  ];

  meta = {
    description = "Declarative statistical visualization library for Python";
    homepage = "https://altair-viz.github.io";
    downloadPage = "https://github.com/altair-viz/altair";
    changelog = "https://altair-viz.github.io/releases/changes.html";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [
      teh
      vinetos
    ];
  };
})