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 pytestCheckHook,
24
25 # reverse dependencies
26 flask-limiter,
27 flask-restful,
28 flask-restx,
29 moto,
30}:
31
32buildPythonPackage rec {
33 pname = "flask";
34 version = "3.1.2";
35 pyproject = true;
36
37 src = fetchPypi {
38 inherit pname version;
39 hash = "sha256-v2VsFcgBkO1iitCM39Oqo1vrCHhV4vSUkQqjd0zE/Yc=";
40 };
41
42 build-system = [ flit-core ];
43
44 dependencies = [
45 click
46 blinker
47 itsdangerous
48 jinja2
49 werkzeug
50 ]
51 ++ lib.optionals (pythonOlder "3.10") [ importlib-metadata ];
52
53 optional-dependencies = {
54 async = [ asgiref ];
55 dotenv = [ python-dotenv ];
56 };
57
58 nativeCheckInputs = [ pytestCheckHook ] ++ lib.flatten (lib.attrValues optional-dependencies);
59
60 passthru.tests = {
61 inherit
62 flask-limiter
63 flask-restful
64 flask-restx
65 moto
66 ;
67 };
68
69 meta = {
70 changelog = "https://flask.palletsprojects.com/en/stable/changes/#version-${
71 lib.replaceStrings [ "." ] [ "-" ] version
72 }";
73 homepage = "https://flask.palletsprojects.com/";
74 description = "Python micro framework for building web applications";
75 mainProgram = "flask";
76 longDescription = ''
77 Flask is a lightweight WSGI web application framework. It is
78 designed to make getting started quick and easy, with the ability
79 to scale up to complex applications. It began as a simple wrapper
80 around Werkzeug and Jinja and has become one of the most popular
81 Python web application frameworks.
82 '';
83 license = lib.licenses.bsd3;
84 maintainers = with lib.maintainers; [ nickcao ];
85 };
86}