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