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.13.3";
14
15 # pypi release does not provide tests
16 src = fetchFromGitHub {
17 owner = "coleifer";
18 repo = pname;
19 rev = version;
20 sha256 = "1r67hxb9m6v0xbnbqfnsw6dahmdr94pf81b4x51jfw6x9sa4izi4";
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 doCheck = withPostgres;
42
43 meta = with stdenv.lib;{
44 description = "a small, expressive orm";
45 homepage = "http://peewee-orm.com";
46 license = licenses.mit;
47 };
48}