1{
2 lib,
3 apsw,
4 buildPythonPackage,
5 cython,
6 fetchFromGitHub,
7 flask,
8 python,
9 sqlite,
10 withMysql ? false,
11 mysql-connector,
12 withPostgres ? false,
13 psycopg2,
14 pythonOlder,
15 setuptools,
16}:
17
18buildPythonPackage rec {
19 pname = "peewee";
20 version = "3.18.2";
21 pyproject = true;
22
23 disabled = pythonOlder "3.7";
24
25 src = fetchFromGitHub {
26 owner = "coleifer";
27 repo = "peewee";
28 tag = version;
29 hash = "sha256-BIOY3vAHzSonxXYFmfFbVxbbUWnUVtcBRsTVMRo7peE=";
30 };
31
32 build-system = [ setuptools ];
33
34 buildInputs = [
35 sqlite
36 cython
37 ];
38
39 propagatedBuildInputs = [
40 apsw
41 ]
42 ++ lib.optionals withPostgres [ psycopg2 ]
43 ++ lib.optionals withMysql [ mysql-connector ];
44
45 nativeCheckInputs = [ flask ];
46
47 doCheck = withPostgres;
48
49 checkPhase = ''
50 rm -r playhouse # avoid using the folder in the cwd
51 ${python.interpreter} runtests.py
52 '';
53
54 pythonImportsCheck = [ "peewee" ];
55
56 meta = with lib; {
57 description = "Python ORM with support for various database implementation";
58 homepage = "http://peewee-orm.com";
59 changelog = "https://github.com/coleifer/peewee/blob/${src.tag}/CHANGELOG.md";
60 license = licenses.mit;
61 maintainers = [ ];
62 mainProgram = "pwiz.py";
63 };
64}