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 ] ++ lib.flatten (lib.attrValues optional-dependencies);
56
57 pythonImportsCheck = [ "werkzeug" ];
58
59 disabledTests = [
60 # ConnectionRefusedError: [Errno 111] Connection refused
61 "test_http_proxy"
62 # ResourceWarning: subprocess 309 is still running
63 "test_basic"
64 "test_long_build"
65 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ "test_get_machine_id" ];
66
67 disabledTestPaths = [
68 # ConnectionRefusedError: [Errno 111] Connection refused
69 "tests/test_serving.py"
70 ];
71
72 pytestFlagsArray = [
73 # don't run tests that are marked with filterwarnings, they fail with
74 # warnings._OptionError: unknown warning category: 'pytest.PytestUnraisableExceptionWarning'
75 "-m 'not filterwarnings'"
76 ];
77
78 passthru.tests = {
79 inherit moto sentry-sdk;
80 };
81
82 meta = {
83 changelog = "https://werkzeug.palletsprojects.com/en/${lib.versions.majorMinor version}.x/changes/#version-${
84 lib.replaceStrings [ "." ] [ "-" ] version
85 }";
86 homepage = "https://palletsprojects.com/p/werkzeug/";
87 description = "Comprehensive WSGI web application library";
88 longDescription = ''
89 Werkzeug is a comprehensive WSGI web application library. It
90 began as a simple collection of various utilities for WSGI
91 applications and has become one of the most advanced WSGI
92 utility libraries.
93 '';
94 license = lib.licenses.bsd3;
95 maintainers = [ ];
96 };
97}