1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 pythonOlder,
6 fetchPypi,
7
8 # build-system
9 flit-core,
10
11 # dependencies
12 markupsafe,
13
14 # optional-dependencies
15 watchdog,
16
17 # tests
18 cffi,
19 cryptography,
20 ephemeral-port-reserve,
21 pytest-timeout,
22 pytestCheckHook,
23
24 # reverse dependencies
25 moto,
26 sentry-sdk,
27}:
28
29buildPythonPackage rec {
30 pname = "werkzeug";
31 version = "3.1.3";
32 pyproject = true;
33
34 disabled = pythonOlder "3.9";
35
36 src = fetchPypi {
37 inherit pname version;
38 hash = "sha256-YHI86UXBkyhnl5DjKCzHWKpKYEDkuzMPU9MPpUbUR0Y=";
39 };
40
41 build-system = [ flit-core ];
42
43 dependencies = [ markupsafe ];
44
45 optional-dependencies = {
46 watchdog = [ watchdog ];
47 };
48
49 nativeCheckInputs = [
50 cffi
51 cryptography
52 ephemeral-port-reserve
53 pytest-timeout
54 pytestCheckHook
55 ]
56 ++ lib.flatten (lib.attrValues optional-dependencies);
57
58 pythonImportsCheck = [ "werkzeug" ];
59
60 disabledTests = [
61 # ConnectionRefusedError: [Errno 111] Connection refused
62 "test_http_proxy"
63 # ResourceWarning: subprocess 309 is still running
64 "test_basic"
65 "test_long_build"
66 ]
67 ++ lib.optionals stdenv.hostPlatform.isDarwin [ "test_get_machine_id" ];
68
69 disabledTestPaths = [
70 # ConnectionRefusedError: [Errno 111] Connection refused
71 "tests/test_serving.py"
72 ];
73
74 disabledTestMarks = [
75 # don't run tests that are marked with filterwarnings, they fail with
76 # warnings._OptionError: unknown warning category: 'pytest.PytestUnraisableExceptionWarning'
77 "filterwarnings"
78 ];
79
80 passthru.tests = {
81 inherit moto sentry-sdk;
82 };
83
84 meta = {
85 changelog = "https://werkzeug.palletsprojects.com/en/${lib.versions.majorMinor version}.x/changes/#version-${
86 lib.replaceStrings [ "." ] [ "-" ] version
87 }";
88 homepage = "https://palletsprojects.com/p/werkzeug/";
89 description = "Comprehensive WSGI web application library";
90 longDescription = ''
91 Werkzeug is a comprehensive WSGI web application library. It
92 began as a simple collection of various utilities for WSGI
93 applications and has become one of the most advanced WSGI
94 utility libraries.
95 '';
96 license = lib.licenses.bsd3;
97 maintainers = [ ];
98 };
99}