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