about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/sqlbag/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/sqlbag/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/sqlbag/default.nix95
1 files changed, 95 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/sqlbag/default.nix b/nixpkgs/pkgs/development/python-modules/sqlbag/default.nix
new file mode 100644
index 000000000000..8b21d89ad5da
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/sqlbag/default.nix
@@ -0,0 +1,95 @@
+{ lib
+, buildPythonPackage
+, fetchFromGitHub
+, isPy27
+, psycopg2
+, pymysql
+, sqlalchemy
+, pathlib
+, six
+, flask
+, pendulum
+, packaging
+, setuptools
+, poetry-core
+, pytestCheckHook
+, pytest-xdist
+, pytest-sugar
+, postgresql
+, postgresqlTestHook
+,
+}:
+buildPythonPackage rec {
+  pname = "sqlbag";
+  version = "0.1.1617247075";
+  format = "pyproject";
+
+  src = fetchFromGitHub {
+    owner = "djrobstep";
+    repo = pname;
+    # no tags on github, version patch number is unix time.
+    rev = "eaaeec4158ffa139fba1ec30d7887f4d836f4120";
+    hash = "sha256-lipgnkqrzjzqwbhtVcWDQypBNzq6Dct/qoM8y/FNiNs=";
+  };
+
+  nativeBuildInputs = [
+    poetry-core
+  ];
+
+  propagatedBuildInputs =
+    [
+      sqlalchemy
+      six
+      packaging
+
+      psycopg2
+      pymysql
+
+      setuptools # needed for 'pkg_resources'
+    ]
+    ++ lib.optional isPy27 pathlib;
+
+  nativeCheckInputs = [
+    pytestCheckHook
+    pytest-xdist
+    pytest-sugar
+
+    postgresql
+    postgresqlTestHook
+
+    flask
+    pendulum
+  ];
+
+  preCheck = ''
+    export PGUSER="nixbld";
+  '';
+  disabledTests = [
+    # These all fail with "List argument must consist only of tuples or dictionaries":
+    # Related issue: https://github.com/djrobstep/sqlbag/issues/14
+    "test_basic"
+    "test_createdrop"
+    "test_errors_and_messages"
+    "test_flask_integration"
+    "test_orm_stuff"
+    "test_pendulum_for_time_types"
+    "test_transaction_separation"
+  ];
+
+  pytestFlagsArray = [
+    "-x"
+    "-svv"
+    "tests"
+  ];
+
+  pythonImportsCheck = [
+    "sqlbag"
+  ];
+
+  meta = with lib; {
+    description = "Handy python code for doing database things";
+    homepage = "https://github.com/djrobstep/sqlbag";
+    license = with licenses; [ unlicense ];
+    maintainers = with maintainers; [ soispha ];
+  };
+}