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