1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 wheel,
7
8 psycopg,
9 aiosqlite,
10 asyncmy,
11
12 # test
13 pytest-asyncio,
14
15 pytestCheckHook,
16}:
17
18buildPythonPackage rec {
19 pname = "mayim";
20 version = "1.1.0";
21 pyproject = true;
22
23 src = fetchFromGitHub {
24 owner = "ahopkins";
25 repo = "mayim";
26 rev = "refs/tags/v${version}";
27 hash = "sha256-nb0E9kMEJUihaCp8RnqGh0nSyDQo50eL1C4K5lBPlPQ=";
28 };
29
30 nativeBuildInputs = [
31 setuptools
32 wheel
33 ];
34
35 postPatch = ''
36 substituteInPlace pyproject.toml \
37 --replace "--cov=src --cov-append --cov-report term-missing" ""
38 '';
39
40 passthru.optional-dependencies = {
41 postgres = [ psycopg ] ++ psycopg.optional-dependencies.pool;
42 mysql = [ asyncmy ];
43 sqlite = [ aiosqlite ];
44 };
45
46 nativeCheckInputs =
47 [
48 pytestCheckHook
49 pytest-asyncio
50 ]
51 ++ (with passthru.optional-dependencies; [
52 postgres
53 mysql
54 sqlite
55 ]);
56
57 pythonImportsCheck = [ "mayim" ];
58
59 meta = with lib; {
60 description = "Asynchronous SQL hydrator";
61 homepage = "https://github.com/ahopkins/mayim";
62 license = licenses.mit;
63 maintainers = with maintainers; [ huyngo ];
64 };
65}