1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 pythonOlder,
6 rustPlatform,
7 cargo,
8 rustc,
9 libiconv,
10 buildPythonPackage,
11 setuptools,
12 setuptools-rust,
13 pytestCheckHook,
14 pytest-mypy-plugins,
15 hypothesis,
16 freezegun,
17 time-machine,
18 nix-update-script,
19}:
20
21buildPythonPackage rec {
22 pname = "whenever";
23 version = "0.8.8";
24 pyproject = true;
25
26 disabled = pythonOlder "3.9";
27
28 src = fetchFromGitHub {
29 owner = "ariebovenberg";
30 repo = "whenever";
31 tag = version;
32 hash = "sha256-i9zUf0oRcG4993Q0kkfndfcEe+mLYFcqrIlg7idKDGY=";
33 };
34
35 cargoDeps = rustPlatform.fetchCargoVendor {
36 inherit src;
37 hash = "sha256-j4sxIcJa406HCDkTJCSU8H+yo2Jth1p8+CaNWlUaIUs=";
38 };
39
40 build-system = [
41 setuptools
42 setuptools-rust
43 rustPlatform.cargoSetupHook
44 cargo
45 rustc
46 ];
47
48 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
49 libiconv
50 ];
51
52 nativeCheckInputs = [
53 pytestCheckHook
54 pytest-mypy-plugins
55 # pytest-benchmark # developer sanity check, should not block distribution
56 hypothesis
57 freezegun
58 time-machine
59 ];
60
61 disabledTestPaths = [
62 # benchmarks
63 "benchmarks/python/test_date.py"
64 "benchmarks/python/test_instant.py"
65 "benchmarks/python/test_local_datetime.py"
66 "benchmarks/python/test_zoned_datetime.py"
67 ];
68
69 pythonImportsCheck = [ "whenever" ];
70
71 # a bunch of failures, including an assumption of what the timezone on the host is
72 # TODO: try enabling on bump
73 doCheck = false;
74
75 passthru.updateScript = nix-update-script { };
76
77 meta = with lib; {
78 description = "Strict, predictable, and typed datetimes";
79 homepage = "https://github.com/ariebovenberg/whenever";
80 changelog = "https://github.com/ariebovenberg/whenever/blob/${src.rev}/CHANGELOG.md";
81 license = licenses.mit;
82 maintainers = with maintainers; [ pbsds ];
83 };
84}