1{ lib
2, apsw
3, buildPythonPackage
4, cython
5, fetchFromGitHub
6, flask
7, python
8, sqlite
9, withMysql ? false
10, mysql-connector
11, withPostgres ? false
12, psycopg2
13}:
14
15buildPythonPackage rec {
16 pname = "peewee";
17 version = "3.14.8";
18 format = "setuptools";
19
20 src = fetchFromGitHub {
21 owner = "coleifer";
22 repo = pname;
23 rev = version;
24 sha256 = "sha256-BJSM+7+VdW6SxN4/AXsX8NhQPdIFoYrVRVwR9OsJ3QE=";
25 };
26
27 buildInputs = [
28 sqlite
29 cython
30 ];
31
32 propagatedBuildInputs = [
33 apsw
34 ] ++ lib.optional withPostgres psycopg2
35 ++ lib.optional withMysql mysql-connector;
36
37 checkInputs = [
38 flask
39 ];
40
41 doCheck = withPostgres;
42
43 checkPhase = ''
44 rm -r playhouse # avoid using the folder in the cwd
45 ${python.interpreter} runtests.py
46 '';
47
48 pythonImportsCheck = [
49 "peewee"
50 ];
51
52 meta = with lib; {
53 description = "Python ORM with support for various database implementation";
54 homepage = "http://peewee-orm.com";
55 license = licenses.mit;
56 maintainers = with maintainers; [ ];
57 };
58}