1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 cython,
8 gdal,
9 setuptools,
10
11 # dependencies
12 attrs,
13 certifi,
14 click,
15 click-plugins,
16 cligj,
17
18 # optional-dependencies
19 pyparsing,
20 shapely,
21 boto3,
22
23 # tests
24 fsspec,
25 pytestCheckHook,
26 pytz,
27 snuggs,
28}:
29
30buildPythonPackage rec {
31 pname = "fiona";
32 version = "1.10.1";
33 pyproject = true;
34
35 src = fetchFromGitHub {
36 owner = "Toblerity";
37 repo = "Fiona";
38 tag = version;
39 hash = "sha256-5NN6PBh+6HS9OCc9eC2TcBvkcwtI4DV8qXnz4tlaMXc=";
40 };
41
42 postPatch = ''
43 substituteInPlace pyproject.toml \
44 --replace-fail "cython~=3.0.2" cython
45 '';
46
47 build-system = [
48 cython
49 gdal # for gdal-config
50 setuptools
51 ];
52
53 buildInputs = [ gdal ];
54
55 dependencies = [
56 attrs
57 certifi
58 click
59 click-plugins
60 cligj
61 ];
62
63 optional-dependencies = {
64 calc = [
65 pyparsing
66 shapely
67 ];
68 s3 = [ boto3 ];
69 };
70
71 nativeCheckInputs = [
72 fsspec
73 pytestCheckHook
74 pytz
75 shapely
76 snuggs
77 ]
78 ++ optional-dependencies.s3;
79
80 preCheck = ''
81 rm -r fiona # prevent importing local fiona
82 '';
83
84 disabledTestMarks = [
85 # Tests with gdal marker do not test the functionality of Fiona,
86 # but they are used to check GDAL driver capabilities.
87 "gdal"
88 ];
89
90 disabledTests = [
91 # Some tests access network, others test packaging
92 "http"
93 "https"
94 "wheel"
95
96 # see: https://github.com/Toblerity/Fiona/issues/1273
97 "test_append_memoryfile_drivers"
98 ];
99
100 pythonImportsCheck = [ "fiona" ];
101
102 doInstallCheck = true;
103
104 meta = {
105 changelog = "https://github.com/Toblerity/Fiona/blob/${src.rev}/CHANGES.txt";
106 description = "OGR's neat, nimble, no-nonsense API for Python";
107 mainProgram = "fio";
108 homepage = "https://fiona.readthedocs.io/";
109 license = lib.licenses.bsd3;
110 teams = [ lib.teams.geospatial ];
111 };
112}