about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/mayim/default.nix
blob: 3cbc740aa458414de656fc9d6f4d5b69c0259079 (plain) (blame)
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
{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools
, wheel

, psycopg
, aiosqlite
, asyncmy

# test
, pytest-asyncio

, pytestCheckHook
}:

buildPythonPackage rec {
  pname = "mayim";
  version = "1.1.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "ahopkins";
    repo = "mayim";
    rev = "refs/tags/v${version}";
    hash = "sha256-nb0E9kMEJUihaCp8RnqGh0nSyDQo50eL1C4K5lBPlPQ=";
  };

  nativeBuildInputs = [
    setuptools
    wheel
  ];

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace "--cov=src --cov-append --cov-report term-missing" ""
  '';

  passthru.optional-dependencies = {
    postgres = [
      psycopg
    ] ++ psycopg.optional-dependencies.pool;
    mysql = [
      asyncmy
    ];
    sqlite = [
      aiosqlite
    ];
  };

  nativeCheckInputs = [
    pytestCheckHook
    pytest-asyncio
  ] ++ (with passthru.optional-dependencies; [postgres mysql sqlite]);

  pythonImportsCheck = [
    "mayim"
  ];

  meta = with lib; {
    description = "Asynchronous SQL hydrator";
    homepage = "https://github.com/ahopkins/mayim";
    license = licenses.mit;
    maintainers = with maintainers; [ huyngo ];
  };
}