1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 setuptools,
6 fetchPypi,
7 typing-extensions,
8 pytest7CheckHook,
9}:
10
11buildPythonPackage rec {
12 pname = "avro";
13 version = "1.11.3";
14 pyproject = true;
15
16 # distutils usage: https://github.com/search?q=repo%3Aapache%2Favro%20distutils&type=code
17 disabled = pythonOlder "3.6";
18
19 src = fetchPypi {
20 inherit pname version;
21 hash = "sha256-M5O7UTn5zweR0gV1bOHjmltYWGr1sVPWo7WhmWEOnRc=";
22 };
23
24 postPatch = lib.optionalString (!pythonOlder "3.12") ''
25 substituteInPlace avro/test/test_tether_word_count.py \
26 --replace-fail 'distutils' 'setuptools._distutils'
27 '';
28
29 propagatedBuildInputs = lib.optionals (pythonOlder "3.8") [ typing-extensions ];
30
31 nativeBuildInputs = [ setuptools ];
32
33 nativeCheckInputs = [ pytest7CheckHook ];
34
35 disabledTests = [
36 # Requires network access
37 "test_server_with_path"
38 # AssertionError: 'reader type: null not compatible with writer type: int'
39 "test_schema_compatibility_type_mismatch"
40 ];
41
42 pythonImportsCheck = [ "avro" ];
43
44 meta = with lib; {
45 description = "Python serialization and RPC framework";
46 mainProgram = "avro";
47 homepage = "https://github.com/apache/avro";
48 changelog = "https://github.com/apache/avro/releases/tag/release-${version}";
49 license = licenses.asl20;
50 maintainers = with maintainers; [ zimbatm ];
51 };
52}