1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 pythonOlder,
6
7 # build-system
8 flit-core,
9
10 # dependencies
11 blinker,
12 click,
13 importlib-metadata,
14 itsdangerous,
15 jinja2,
16 werkzeug,
17
18 # optional-dependencies
19 asgiref,
20 python-dotenv,
21
22 # tests
23 greenlet,
24 pytestCheckHook,
25
26 # reverse dependencies
27 flask-limiter,
28 flask-restful,
29 flask-restx,
30 moto,
31}:
32
33buildPythonPackage rec {
34 pname = "flask";
35 version = "3.0.3";
36 format = "pyproject";
37
38 src = fetchPypi {
39 inherit pname version;
40 hash = "sha256-zrJ7CvOCPqJzeSik2Z0SWgYXW4USxEXL2anOIA73aEI=";
41 };
42
43 nativeBuildInputs = [ flit-core ];
44
45 propagatedBuildInputs = [
46 click
47 blinker
48 itsdangerous
49 jinja2
50 werkzeug
51 ] ++ lib.optionals (pythonOlder "3.10") [ importlib-metadata ];
52
53 passthru.optional-dependencies = {
54 async = [ asgiref ];
55 dotenv = [ python-dotenv ];
56 };
57
58 nativeCheckInputs =
59 [ pytestCheckHook ]
60 ++ lib.optionals (pythonOlder "3.11") [ greenlet ]
61 ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
62
63 passthru.tests = {
64 inherit
65 flask-limiter
66 flask-restful
67 flask-restx
68 moto
69 ;
70 };
71
72 meta = with lib; {
73 changelog = "https://flask.palletsprojects.com/en/${versions.majorMinor version}.x/changes/#version-${
74 replaceStrings [ "." ] [ "-" ] version
75 }";
76 homepage = "https://flask.palletsprojects.com/";
77 description = "The Python micro framework for building web applications";
78 mainProgram = "flask";
79 longDescription = ''
80 Flask is a lightweight WSGI web application framework. It is
81 designed to make getting started quick and easy, with the ability
82 to scale up to complex applications. It began as a simple wrapper
83 around Werkzeug and Jinja and has become one of the most popular
84 Python web application frameworks.
85 '';
86 license = licenses.bsd3;
87 maintainers = with maintainers; [ nickcao ];
88 };
89}