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