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