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.1";
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-7MLDhMiW9LaedPMQ2QqSqos4SegzUmTX1joyV18MkEg=";
30 };
31
32 build-system = [ setuptools ];
33
34 buildInputs = [
35 sqlite
36 cython
37 ];
38
39 propagatedBuildInputs =
40 [
41 apsw
42 ]
43 ++ lib.optionals withPostgres [ psycopg2 ]
44 ++ lib.optionals withMysql [ mysql-connector ];
45
46 nativeCheckInputs = [ flask ];
47
48 doCheck = withPostgres;
49
50 checkPhase = ''
51 rm -r playhouse # avoid using the folder in the cwd
52 ${python.interpreter} runtests.py
53 '';
54
55 pythonImportsCheck = [ "peewee" ];
56
57 meta = with lib; {
58 description = "Python ORM with support for various database implementation";
59 homepage = "http://peewee-orm.com";
60 changelog = "https://github.com/coleifer/peewee/blob/${src.tag}/CHANGELOG.md";
61 license = licenses.mit;
62 maintainers = [ ];
63 mainProgram = "pwiz.py";
64 };
65}