1{
2 lib,
3 buildPythonPackage,
4 dramatiq,
5 fetchFromGitLab,
6 flask-migrate,
7 flask,
8 periodiq,
9 poetry-core,
10 postgresql,
11 postgresqlTestHook,
12 psycopg2,
13 pytest-cov-stub,
14 pytest-mock,
15 pytestCheckHook,
16 requests,
17}:
18
19buildPythonPackage {
20 pname = "flask-dramatiq";
21 version = "0.6.0";
22 pyproject = true;
23
24 src = fetchFromGitLab {
25 owner = "bersace";
26 repo = "flask-dramatiq";
27 rev = "840209e9bf582b4dda468e8bba515f248f3f8534";
28 hash = "sha256-qjV1zyVzHPXMt+oUeGBdP9XVlbcSz2MF9Zygj543T4w=";
29 };
30
31 postPatch = ''
32 substituteInPlace pyproject.toml \
33 --replace 'poetry>=0.12' 'poetry-core' \
34 --replace 'poetry.masonry.api' 'poetry.core.masonry.api'
35
36 patchShebangs --build ./example.py
37 '';
38
39 build-system = [ poetry-core ];
40
41 dependencies = [ dramatiq ];
42
43 nativeCheckInputs = [
44 flask
45 flask-migrate
46 periodiq
47 postgresql
48 postgresqlTestHook
49 psycopg2
50 pytest-cov-stub
51 pytest-mock
52 pytestCheckHook
53 requests
54 ]
55 ++ dramatiq.optional-dependencies.rabbitmq;
56
57 postgresqlTestSetupPost = ''
58 substituteInPlace config.py \
59 --replace 'SQLALCHEMY_DATABASE_URI = f"postgresql://{PGUSER}:{PGPASSWORD}@{PGHOST}/{PGDATABASE}"' \
60 "SQLALCHEMY_DATABASE_URI = \"postgresql://$PGUSER/$PGDATABASE?host=$PGHOST\""
61 python3 ./example.py db upgrade
62 '';
63
64 disabledTests = [
65 "test_fast"
66 "test_other"
67 ];
68
69 pythonImportsCheck = [ "flask_dramatiq" ];
70
71 meta = with lib; {
72 description = "Adds Dramatiq support to your Flask application";
73 homepage = "https://gitlab.com/bersace/flask-dramatiq";
74 license = licenses.bsd3;
75 maintainers = with maintainers; [ traxys ];
76 };
77}