1{ buildPythonPackage
2, cython
3, fetchFromGitHub
4, isPy38
5, lib
6, lz4
7, numpy
8, pandas
9, pytestCheckHook
10, python-dateutil
11, python-snappy
12, pythonOlder
13, zstandard
14}:
15
16buildPythonPackage rec {
17 pname = "fastavro";
18 version = "1.8.3";
19 format = "setuptools";
20
21 disabled = pythonOlder "3.6";
22
23 src = fetchFromGitHub {
24 owner = pname;
25 repo = pname;
26 rev = "refs/tags/${version}";
27 hash = "sha256-W+fFZAQU7W6gDqB6LOrG8se6mBATFZWmepTt1HSphbE=";
28 };
29
30 preBuild = ''
31 export FASTAVRO_USE_CYTHON=1
32 '';
33
34 nativeBuildInputs = [ cython ];
35
36 passthru.optional-dependencies = {
37 codecs = [
38 lz4
39 python-snappy
40 zstandard
41 ];
42 snappy = [
43 python-snappy
44 ];
45 zstandard = [
46 zstandard
47 ];
48 lz4 = [
49 lz4
50 ];
51 };
52
53 nativeCheckInputs = [
54 numpy
55 pandas
56 pytestCheckHook
57 python-dateutil
58 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
59
60 # Fails with "AttributeError: module 'fastavro._read_py' has no attribute
61 # 'CYTHON_MODULE'." Doesn't appear to be serious. See https://github.com/fastavro/fastavro/issues/112#issuecomment-387638676.
62 disabledTests = [ "test_cython_python" ];
63
64 # CLI tests are broken on Python 3.8. See https://github.com/fastavro/fastavro/issues/558.
65 disabledTestPaths = lib.optionals isPy38 [ "tests/test_main_cli.py" ];
66
67 pythonImportsCheck = [ "fastavro" ];
68
69 meta = with lib; {
70 description = "Fast read/write of AVRO files";
71 homepage = "https://github.com/fastavro/fastavro";
72 changelog = "https://github.com/fastavro/fastavro/blob/${version}/ChangeLog";
73 license = licenses.mit;
74 maintainers = with maintainers; [ samuela ];
75 };
76}