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