Merge pull request #307098 from r-ryantm/auto-update/cilium-cli
[NixPkgs.git] / pkgs / development / python-modules / flask-dramatiq / default.nix
blob6f8884516f4989d183ff7a46a35624ff31ea27dc
1 { lib
2 , buildPythonPackage
3 , pythonOlder
4 , fetchFromGitLab
5 , poetry-core
6 , dramatiq
7 , flask
8 , requests
9 , pytestCheckHook
10 , flask-migrate
11 , periodiq
12 , postgresql
13 , postgresqlTestHook
14 , psycopg2
17 buildPythonPackage {
18   pname = "flask-dramatiq";
19   version = "0.6.0";
20   format = "pyproject";
22   disabled = pythonOlder "3.6";
24   src = fetchFromGitLab {
25     owner = "bersace";
26     repo = "flask-dramatiq";
27     rev = "840209e9bf582b4dda468e8bba515f248f3f8534";
28     hash = "sha256-qjV1zyVzHPXMt+oUeGBdP9XVlbcSz2MF9Zygj543T4w=";
29   };
31   postPatch = ''
32     substituteInPlace pyproject.toml \
33       --replace 'poetry>=0.12' 'poetry-core' \
34       --replace 'poetry.masonry.api' 'poetry.core.masonry.api'
36     patchShebangs --build ./example.py
38     sed -i ./tests/unit/pytest.ini \
39       -e 's:--cov=flask_dramatiq::' \
40       -e 's:--cov-report=term-missing::'
41   '';
43   nativeBuildInputs = [
44     poetry-core
45   ];
47   propagatedBuildInputs = [
48     dramatiq
49   ];
51   nativeCheckInputs = [
52     pytestCheckHook
53     flask
54     requests
55     flask-migrate
56     periodiq
57     postgresql
58     postgresqlTestHook
59     psycopg2
60   ] ++ dramatiq.optional-dependencies.rabbitmq;
62   postgresqlTestSetupPost = ''
63     substituteInPlace config.py \
64       --replace 'SQLALCHEMY_DATABASE_URI = f"postgresql://{PGUSER}:{PGPASSWORD}@{PGHOST}/{PGDATABASE}"' \
65         "SQLALCHEMY_DATABASE_URI = \"postgresql://$PGUSER/$PGDATABASE?host=$PGHOST\""
66     python3 ./example.py db upgrade
67   '';
69   pytestFlagsArray = [ "-x" "tests/func/" "tests/unit"];
71   pythonImportsCheck = [ "flask_dramatiq" ];
73   # Does HTTP requests to localhost
74   disabledTests = [
75     "test_fast"
76     "test_other"
77   ];
79   meta = with lib; {
80     description = "Adds Dramatiq support to your Flask application";
81     homepage = "https://gitlab.com/bersace/flask-dramatiq";
82     license = licenses.bsd3;
83     maintainers = with maintainers; [ traxys ];
84   };