nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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 pythonRelaxDeps = [ "dramatiq" ];
42
43 dependencies = [ dramatiq ];
44
45 nativeCheckInputs = [
46 flask
47 flask-migrate
48 periodiq
49 postgresql
50 postgresqlTestHook
51 psycopg2
52 pytest-cov-stub
53 pytest-mock
54 pytestCheckHook
55 requests
56 ]
57 ++ dramatiq.optional-dependencies.rabbitmq;
58
59 postgresqlTestSetupPost = ''
60 substituteInPlace config.py \
61 --replace 'SQLALCHEMY_DATABASE_URI = f"postgresql://{PGUSER}:{PGPASSWORD}@{PGHOST}/{PGDATABASE}"' \
62 "SQLALCHEMY_DATABASE_URI = \"postgresql://$PGUSER/$PGDATABASE?host=$PGHOST\""
63 python3 ./example.py db upgrade
64 '';
65
66 disabledTests = [
67 "test_fast"
68 "test_other"
69 ];
70
71 pythonImportsCheck = [ "flask_dramatiq" ];
72
73 meta = {
74 description = "Adds Dramatiq support to your Flask application";
75 homepage = "https://gitlab.com/bersace/flask-dramatiq";
76 license = lib.licenses.bsd3;
77 maintainers = with lib.maintainers; [ traxys ];
78 };
79}