summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/flask-dramatiq/default.nix
blob: cded223066c1d19baa525ad46462e2b16a9d536e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{
  lib,
  buildPythonPackage,
  dramatiq,
  fetchFromGitLab,
  flask-migrate,
  flask,
  periodiq,
  poetry-core,
  postgresql,
  postgresqlTestHook,
  psycopg2,
  pytest-cov-stub,
  pytest-mock,
  pytestCheckHook,
  requests,
}:

buildPythonPackage {
  pname = "flask-dramatiq";
  version = "0.6.0";
  pyproject = true;

  src = fetchFromGitLab {
    owner = "bersace";
    repo = "flask-dramatiq";
    rev = "840209e9bf582b4dda468e8bba515f248f3f8534";
    hash = "sha256-qjV1zyVzHPXMt+oUeGBdP9XVlbcSz2MF9Zygj543T4w=";
  };

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace 'poetry>=0.12' 'poetry-core' \
      --replace 'poetry.masonry.api' 'poetry.core.masonry.api'

    patchShebangs --build ./example.py
  '';

  build-system = [ poetry-core ];

  dependencies = [ dramatiq ];

  nativeCheckInputs = [
    flask
    flask-migrate
    periodiq
    postgresql
    postgresqlTestHook
    psycopg2
    pytest-cov-stub
    pytest-mock
    pytestCheckHook
    requests
  ]
  ++ dramatiq.optional-dependencies.rabbitmq;

  postgresqlTestSetupPost = ''
    substituteInPlace config.py \
      --replace 'SQLALCHEMY_DATABASE_URI = f"postgresql://{PGUSER}:{PGPASSWORD}@{PGHOST}/{PGDATABASE}"' \
        "SQLALCHEMY_DATABASE_URI = \"postgresql://$PGUSER/$PGDATABASE?host=$PGHOST\""
    python3 ./example.py db upgrade
  '';

  disabledTests = [
    "test_fast"
    "test_other"
  ];

  pythonImportsCheck = [ "flask_dramatiq" ];

  meta = {
    description = "Adds Dramatiq support to your Flask application";
    homepage = "https://gitlab.com/bersace/flask-dramatiq";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ traxys ];
  };
}