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 cryptography,
19 ephemeral-port-reserve,
20 greenlet,
21 pytest-timeout,
22 pytest-xprocess,
23 pytestCheckHook,
24
25 # reverse dependencies
26 moto,
27 sentry-sdk,
28}:
29
30buildPythonPackage rec {
31 pname = "werkzeug";
32 version = "3.0.3";
33 format = "pyproject";
34
35 disabled = pythonOlder "3.8";
36
37 src = fetchPypi {
38 inherit pname version;
39 hash = "sha256-CX5b/anwq6jaa4VFFG3vSB0Gqn0yZudEjizM9n3YvRg=";
40 };
41
42 nativeBuildInputs = [ flit-core ];
43
44 propagatedBuildInputs = [ markupsafe ];
45
46 passthru.optional-dependencies = {
47 watchdog = lib.optionals (!stdenv.isDarwin) [
48 # watchdog requires macos-sdk 10.13
49 watchdog
50 ];
51 };
52
53 nativeCheckInputs =
54 [
55 cryptography
56 ephemeral-port-reserve
57 pytest-timeout
58 pytest-xprocess
59 pytestCheckHook
60 ]
61 ++ lib.optionals (pythonOlder "3.11") [ greenlet ]
62 ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
63
64 pythonImportsCheck = [ "werkzeug" ];
65
66 disabledTests = lib.optionals stdenv.isDarwin [ "test_get_machine_id" ];
67
68 disabledTestPaths = [
69 # ConnectionRefusedError: [Errno 111] Connection refused
70 "tests/test_serving.py"
71 ];
72
73 pytestFlagsArray = [
74 # don't run tests that are marked with filterwarnings, they fail with
75 # warnings._OptionError: unknown warning category: 'pytest.PytestUnraisableExceptionWarning'
76 "-m 'not filterwarnings'"
77 ];
78
79 passthru.tests = {
80 inherit moto sentry-sdk;
81 };
82
83 meta = {
84 changelog = "https://werkzeug.palletsprojects.com/en/${lib.versions.majorMinor version}.x/changes/#version-${
85 lib.replaceStrings [ "." ] [ "-" ] version
86 }";
87 homepage = "https://palletsprojects.com/p/werkzeug/";
88 description = "Comprehensive WSGI web application library";
89 longDescription = ''
90 Werkzeug is a comprehensive WSGI web application library. It
91 began as a simple collection of various utilities for WSGI
92 applications and has become one of the most advanced WSGI
93 utility libraries.
94 '';
95 license = lib.licenses.bsd3;
96 maintainers = [ ];
97 };
98}