nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 isPyPy,
7
8 # build-system
9 poetry-core,
10 rustPlatform,
11
12 # native dependencies
13 iconv,
14
15 # dependencies
16 python-dateutil,
17 time-machine,
18 tzdata,
19
20 # tests
21 pytestCheckHook,
22 pytz,
23}:
24
25buildPythonPackage rec {
26 pname = "pendulum";
27 version = "3.1.0-unstable-2025-10-28";
28 pyproject = true;
29
30 src = fetchFromGitHub {
31 owner = "sdispater";
32 repo = "pendulum";
33 rev = "2982f25feaad2e58ad1530d3b53cc30fc1c82bd6";
34 hash = "sha256-1ULvlWLZx3z5eGmWJfrN46x0ohJ+mAxipm6l6rykGPY=";
35 };
36
37 cargoRoot = "rust";
38 cargoDeps = rustPlatform.fetchCargoVendor {
39 inherit pname version src;
40 sourceRoot = "${src.name}/rust";
41 hash = "sha256-Ozg+TW/woJsqmbmyDsgdMua3Lmnn+KBvBhd9kVik3XY=";
42 };
43
44 nativeBuildInputs = [
45 poetry-core
46 rustPlatform.maturinBuildHook
47 rustPlatform.cargoSetupHook
48 ];
49
50 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ iconv ];
51
52 propagatedBuildInputs = [
53 python-dateutil
54 tzdata
55 ]
56 ++ lib.optionals (!isPyPy) [
57 time-machine
58 ];
59
60 pythonImportsCheck = [ "pendulum" ];
61
62 nativeCheckInputs = [
63 pytestCheckHook
64 pytz
65 ];
66
67 disabledTestPaths = [
68 "tests/benchmarks"
69 ]
70 ++ lib.optionals stdenv.hostPlatform.isDarwin [
71 # PermissionError: [Errno 1] Operation not permitted: '/etc/localtime'
72 "tests/testing/test_time_travel.py"
73 ];
74
75 meta = {
76 description = "Python datetimes made easy";
77 homepage = "https://github.com/sdispater/pendulum";
78 changelog = "https://github.com/sdispater/pendulum/blob/${src.rev}/CHANGELOG.md";
79 license = lib.licenses.mit;
80 maintainers = [ ];
81 };
82}