1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, sqlite
5, cython
6, apsw
7, flask
8, withPostgres ? false, psycopg2
9, withMysql ? false, mysql-connector
10}:
11
12buildPythonPackage rec {
13
14 pname = "peewee";
15 version = "3.14.4";
16
17 # pypi release does not provide tests
18 src = fetchFromGitHub {
19 owner = "coleifer";
20 repo = pname;
21 rev = version;
22 sha256 = "0x85swpaffysc05kka0mab87cnilzw1lpacfhcx5ayabh0i2qsh6";
23 };
24
25
26 checkInputs = [ flask ];
27
28 checkPhase = ''
29 rm -r playhouse # avoid using the folder in the cwd
30 python runtests.py
31 '';
32
33 buildInputs = [
34 sqlite
35 cython # compile speedups
36 ];
37
38 propagatedBuildInputs = [
39 apsw # sqlite performance improvement
40 ] ++ (lib.optional withPostgres psycopg2)
41 ++ (lib.optional withMysql mysql-connector);
42
43 doCheck = withPostgres;
44
45 meta = with lib; {
46 description = "a small, expressive orm";
47 homepage = "http://peewee-orm.com";
48 license = licenses.mit;
49 };
50}