1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 rustPlatform,
6
7 # nativeBuildInputs
8 cargo,
9 rustc,
10
11 # dependencies
12 pyarrow,
13
14 # optional-dependencies
15 pandas,
16 polars,
17
18 # tests
19 pytest-mock,
20 pytestCheckHook,
21}:
22
23buildPythonPackage rec {
24 pname = "fastexcel";
25 version = "0.14.0";
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "ToucanToco";
30 repo = "fastexcel";
31 tag = "v${version}";
32 hash = "sha256-sBpefpJm8b+6WQeO7zqihFDYPRnMZUQFSapcDkqekI0=";
33 };
34
35 cargoDeps = rustPlatform.fetchCargoVendor {
36 inherit pname version src;
37 hash = "sha256-gwLVxW9ETzvnI0tE8EWr8pUtvsBAQ/tC4tgEso15N3M=";
38 };
39
40 nativeBuildInputs = [
41 cargo
42 rustPlatform.cargoSetupHook
43 rustPlatform.maturinBuildHook
44 rustc
45 ];
46
47 dependencies = [
48 pyarrow
49 ];
50
51 optional-dependencies = {
52 pandas = [
53 pandas
54 ];
55 polars = [
56 polars
57 ];
58 };
59
60 pythonImportsCheck = [
61 "fastexcel"
62 ];
63
64 nativeCheckInputs = [
65 pandas
66 polars
67 pytest-mock
68 pytestCheckHook
69 ];
70
71 meta = {
72 description = "Fast excel file reader for Python, written in Rust";
73 homepage = "https://github.com/ToucanToco/fastexcel/";
74 changelog = "https://github.com/ToucanToco/fastexcel/releases/tag/v${version}";
75 license = lib.licenses.mit;
76 maintainers = with lib.maintainers; [ GaetanLepage ];
77 };
78}