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.0";
36 pyproject = true;
37
38 src = fetchPypi {
39 inherit pname version;
40 hash = "sha256-X4c8UYTIl8jZ0bBd8ePQGxSRDOaWB6EXvTJ3CYpYNqw=";
41 };
42
43 build-system = [ flit-core ];
44
45 dependencies = [
46 click
47 blinker
48 itsdangerous
49 jinja2
50 werkzeug
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 = with lib; {
70 changelog = "https://flask.palletsprojects.com/en/${versions.majorMinor version}.x/changes/#version-${
71 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 = licenses.bsd3;
84 maintainers = with maintainers; [ nickcao ];
85 };
86}