1{
2 lib,
3 fetchFromGitHub,
4 buildPythonPackage,
5 pythonOlder,
6 cython,
7 pytestCheckHook,
8 requests-toolbelt,
9}:
10
11buildPythonPackage rec {
12 pname = "streaming-form-data";
13 version = "1.13.0";
14 format = "setuptools";
15 disabled = pythonOlder "3.6";
16
17 src = fetchFromGitHub {
18 owner = "siddhantgoel";
19 repo = "streaming-form-data";
20 rev = "v${version}";
21 hash = "sha256-Ntiad5GZtfRd+2uDPgbDzLBzErGFroffK6ZAmMcsfXA=";
22 };
23
24 # streaming-form-data has a small bit of code that uses smart_open, which has a massive closure.
25 # The only consumer of streaming-form-data is Moonraker, which doesn't use that code.
26 # So, just drop the dependency to not have to deal with it.
27 patches = [ ./drop-smart-open.patch ];
28
29 nativeBuildInputs = [ cython ];
30
31 nativeCheckInputs = [
32 pytestCheckHook
33 requests-toolbelt
34 ];
35
36 pytestFlagsArray = [ "tests" ];
37
38 pythonImportsCheck = [ "streaming_form_data" ];
39
40 preCheck = ''
41 # remove in-tree copy to make pytest find the installed one, with the native parts already built
42 rm -rf streaming_form_data
43 '';
44
45 meta = with lib; {
46 description = "Streaming parser for multipart/form-data";
47 homepage = "https://github.com/siddhantgoel/streaming-form-data";
48 license = licenses.mit;
49 maintainers = with maintainers; [ zhaofengli ];
50 };
51}