1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 rustPlatform,
6 protobuf,
7 libffi,
8 callPackage,
9 librusty_v8 ? callPackage ./librusty_v8.nix { },
10 nix-update-script,
11}:
12buildPythonPackage rec {
13 pname = "vl-convert-python";
14 version = "1.8.0";
15 pyproject = true;
16
17 src = fetchFromGitHub {
18 owner = "vega";
19 repo = "vl-convert";
20 tag = "v${version}";
21 hash = "sha256-jOqqqr6O/wHFwUHJ/7iE4N/JXXH1MvqQkAQJ47Ww7YI=";
22 };
23
24 patches = [ ./libffi-sys-system-feature.patch ];
25
26 cargoDeps = rustPlatform.fetchCargoVendor {
27 inherit src;
28 name = "${pname}-${version}";
29 hash = "sha256-oPUpX7aMZBSsVujcXkIBNL8pk2JJ0RyBCwoVsuARkkQ=";
30 };
31
32 buildAndTestSubdir = "vl-convert-python";
33
34 env.RUSTY_V8_ARCHIVE = librusty_v8;
35
36 build-system = [
37 rustPlatform.maturinBuildHook
38 rustPlatform.cargoSetupHook
39 ];
40
41 nativeBuildInputs = [ protobuf ];
42
43 buildInputs = [ libffi ];
44
45 pythonImportsCheck = [ "vl_convert" ];
46
47 passthru.updateScript = nix-update-script {
48 extraArgs = [
49 "--version-regex"
50 "vl-convert-python@(.*)"
51 ];
52 };
53
54 meta = {
55 description = "Utilities for converting Vega-Lite specs from the command line and Python";
56 license = lib.licenses.bsd3;
57 homepage = "https://github.com/vega/vl-convert";
58 changelog = "https://github.com/vega/vl-convert/releases/tag/v${version}";
59 maintainers = with lib.maintainers; [ antonmosich ];
60 };
61}