1{
2 lib,
3 buildPackages,
4 buildPythonPackage,
5 cargo,
6 fetchFromGitHub,
7 maturin,
8 nexusrpc,
9 nix-update-script,
10 nixosTests,
11 pythonOlder,
12 poetry-core,
13 protobuf5,
14 python-dateutil,
15 rustc,
16 rustPlatform,
17 setuptools,
18 setuptools-rust,
19 types-protobuf,
20 typing-extensions,
21}:
22
23buildPythonPackage rec {
24 pname = "temporalio";
25 version = "1.18.1";
26 pyproject = true;
27
28 disabled = pythonOlder "3.8";
29
30 src = fetchFromGitHub {
31 owner = "temporalio";
32 repo = "sdk-python";
33 rev = "refs/tags/${version}";
34 hash = "sha256-53UDG6eN7Jv8nUUh84I1SX9Gc+gZK66o6e4pqe9aWq4=";
35 fetchSubmodules = true;
36 };
37
38 cargoDeps = rustPlatform.fetchCargoVendor {
39 inherit
40 pname
41 version
42 src
43 cargoRoot
44 ;
45 hash = "sha256-2/AH8ffSRXBrzF2G9n8MdJfbOrSnSVPRfB1fDm8wFU0=";
46 };
47
48 cargoRoot = "temporalio/bridge";
49
50 build-system = [
51 maturin
52 poetry-core
53 ];
54
55 preBuild = ''
56 export PROTOC=${buildPackages.protobuf}/bin/protoc
57 '';
58
59 dependencies = [
60 nexusrpc
61 protobuf5
62 types-protobuf
63 typing-extensions
64 ]
65 ++ lib.optional (pythonOlder "3.11") python-dateutil;
66
67 nativeBuildInputs = [
68 cargo
69 rustPlatform.cargoSetupHook
70 rustPlatform.maturinBuildHook
71 rustc
72 setuptools
73 setuptools-rust
74 ];
75
76 pythonImportsCheck = [
77 "temporalio"
78 "temporalio.bridge.temporal_sdk_bridge"
79 "temporalio.client"
80 "temporalio.worker"
81 ];
82
83 passthru = {
84 tests = { inherit (nixosTests) temporal; };
85 updateScript = nix-update-script { };
86 };
87
88 meta = {
89 description = "Temporal Python SDK";
90 homepage = "https://temporal.io/";
91 changelog = "https://github.com/temporalio/sdk-python/releases/tag/${version}";
92 license = lib.licenses.mit;
93 maintainers = with lib.maintainers; [
94 jpds
95 levigross
96 ];
97 };
98}