summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/fiona/default.nix
blob: 04d5d9b8f5f604e98fa55058e8338cc0f6a2bc5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  cython,
  gdal,
  setuptools,

  # dependencies
  attrs,
  certifi,
  click,
  click-plugins,
  cligj,

  # optional-dependencies
  pyparsing,
  shapely,
  boto3,

  # tests
  fsspec,
  pytestCheckHook,
  pytz,
  snuggs,
}:

buildPythonPackage rec {
  pname = "fiona";
  version = "1.10.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "Toblerity";
    repo = "Fiona";
    tag = version;
    hash = "sha256-5NN6PBh+6HS9OCc9eC2TcBvkcwtI4DV8qXnz4tlaMXc=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail "cython~=3.0.2" cython
  '';

  build-system = [
    cython
    gdal # for gdal-config
    setuptools
  ];

  buildInputs = [ gdal ];

  dependencies = [
    attrs
    certifi
    click
    click-plugins
    cligj
  ];

  optional-dependencies = {
    calc = [
      pyparsing
      shapely
    ];
    s3 = [ boto3 ];
  };

  nativeCheckInputs = [
    fsspec
    pytestCheckHook
    pytz
    shapely
    snuggs
  ]
  ++ optional-dependencies.s3;

  preCheck = ''
    rm -r fiona # prevent importing local fiona
  '';

  disabledTestMarks = [
    # Tests with gdal marker do not test the functionality of Fiona,
    # but they are used to check GDAL driver capabilities.
    "gdal"
  ];

  disabledTests = [
    # Some tests access network, others test packaging
    "http"
    "https"
    "wheel"

    # see: https://github.com/Toblerity/Fiona/issues/1273
    "test_append_memoryfile_drivers"

    # AssertionError CLI exists with non-zero error code
    # This is a regression introduced by https://github.com/NixOS/nixpkgs/pull/448189
    "test_bbox_json_yes"
    "test_bbox_no"
    "test_bbox_where"
    "test_bbox_yes"
    "test_bbox_yes_two_files"
    "test_bool_seq"
    "test_bounds_explode_with_obj"
    "test_calc_seq"
    "test_collect_ld"
    "test_collect_no_rs"
    "test_collect_noparse"
    "test_collect_noparse_records"
    "test_collect_noparse_rs"
    "test_collect_rec_buffered"
    "test_collect_rs"
    "test_creation_options"
    "test_different_crs"
    "test_distrib"
    "test_distrib_no_rs"
    "test_dst_crs_default_to_src_crs"
    "test_dst_crs_epsg3857"
    "test_dst_crs_no_src"
    "test_existing_property"
    "test_explode"
    "test_explode_output_rs"
    "test_explode_pp"
    "test_explode_with_id"
    "test_filter"
    "test_fio_load_layer"
    "test_fio_load_layer_append"
    "test_load__auto_detect_format"
    "test_load__auto_detect_format"
    "test_load__auto_detect_format"
    "test_load__auto_detect_format"
    "test_load__auto_detect_format"
    "test_map_count"
    "test_multi_layer"
    "test_one"
    "test_precision"
    "test_reduce_area"
    "test_reduce_area"
    "test_reduce_union"
    "test_reduce_union_zip_properties"
    "test_seq"
    "test_seq"
    "test_seq_no_rs"
    "test_seq_rs"
    "test_seq_rs"
    "test_two"
    "test_vfs"
    "test_where_no"
    "test_where_yes"
    "test_where_yes_two_files"
    "test_with_id"
    "test_with_obj"
  ];

  pythonImportsCheck = [ "fiona" ];

  doInstallCheck = true;

  meta = {
    changelog = "https://github.com/Toblerity/Fiona/blob/${src.rev}/CHANGES.txt";
    description = "OGR's neat, nimble, no-nonsense API for Python";
    mainProgram = "fio";
    homepage = "https://fiona.readthedocs.io/";
    license = lib.licenses.bsd3;
    teams = [ lib.teams.geospatial ];
  };
}