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