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