1{ lib
2, buildPythonPackage
3, pythonOlder
4, fetchFromGitHub
5, poetry-core
6, fetchpatch
7, pytestCheckHook
8, pycodestyle
9, pyyaml
10}:
11
12buildPythonPackage rec {
13 pname = "tinydb";
14 version = "4.4.0";
15 disabled = pythonOlder "3.5";
16 format = "pyproject";
17
18 src = fetchFromGitHub {
19 owner = "msiemens";
20 repo = pname;
21 rev = "v${version}";
22 sha256 = "sha256-3FbsnLU7G4VVhI5NYRqCEQgo51zDeAkEhH69H52zr/w=";
23 };
24
25 nativeBuildInputs = [
26 poetry-core
27 ];
28
29 patches = [
30 # Switch to poetry-core, https://github.com/msiemens/tinydb/pull/391
31 (fetchpatch {
32 name = "switch-to-peotry-core.patch";
33 url = "https://github.com/msiemens/tinydb/commit/5b547c18e7ce9f5925d5943dfa47d408435a0da5.patch";
34 sha256 = "19ma9ib020b82sn1mcr7sfysqbj8h6nbb365bih1x1wn3ym8xlbc";
35 })
36 ];
37
38 postPatch = ''
39 substituteInPlace pytest.ini \
40 --replace "--cov-append --cov-report term --cov tinydb" ""
41 '';
42
43 checkInputs = [
44 pytestCheckHook
45 pycodestyle
46 pyyaml
47 ];
48
49 pythonImportsCheck = [ "tinydb" ];
50
51 meta = with lib; {
52 description = "Lightweight document oriented database written in Python";
53 homepage = "https://tinydb.readthedocs.org/";
54 changelog = "https://tinydb.readthedocs.io/en/latest/changelog.html";
55 license = licenses.mit;
56 maintainers = with maintainers; [ marcus7070 ];
57 };
58}