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.17.5";
21 pyproject = true;
22
23 disabled = pythonOlder "3.7";
24
25 src = fetchFromGitHub {
26 owner = "coleifer";
27 repo = "peewee";
28 rev = "refs/tags/${version}";
29 hash = "sha256-2SrqWPyeDBKOweLu7bEcDIAqCCtnKv0VBdzfpaA22ow=";
30 };
31
32 build-system = [ setuptools ];
33
34 buildInputs = [
35 sqlite
36 cython
37 ];
38
39 propagatedBuildInputs = [
40 apsw
41 ] ++ lib.optionals withPostgres [ psycopg2 ] ++ lib.optionals withMysql [ mysql-connector ];
42
43 nativeCheckInputs = [ flask ];
44
45 doCheck = withPostgres;
46
47 checkPhase = ''
48 rm -r playhouse # avoid using the folder in the cwd
49 ${python.interpreter} runtests.py
50 '';
51
52 pythonImportsCheck = [ "peewee" ];
53
54 meta = with lib; {
55 description = "Python ORM with support for various database implementation";
56 homepage = "http://peewee-orm.com";
57 changelog = "https://github.com/coleifer/peewee/blob/${version}/CHANGELOG.md";
58 license = licenses.mit;
59 maintainers = with maintainers; [ ];
60 mainProgram = "pwiz.py";
61 };
62}