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.11.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-942EmFOAYUWq58MW2rIVhDK9dHkzi62fUdOudYP94hU=";
32 fetchSubmodules = true;
33 };
34
35 cargoDeps = rustPlatform.fetchCargoVendor {
36 inherit pname version src;
37 sourceRoot = "${src.name}/${cargoRoot}";
38 hash = "sha256-9hP+zN6jcRmRhPmcZ4Zgp61IeS7gDPfsOvweAxKHnHM=";
39 };
40
41 cargoRoot = "temporalio/bridge";
42
43 build-system = [
44 maturin
45 poetry-core
46 ];
47
48 preBuild = ''
49 export PROTOC=${buildPackages.protobuf}/bin/protoc
50 '';
51
52 dependencies = [
53 protobuf
54 types-protobuf
55 typing-extensions
56 ] ++ lib.optional (pythonOlder "3.11") python-dateutil;
57
58 nativeBuildInputs = [
59 cargo
60 rustPlatform.cargoSetupHook
61 rustPlatform.maturinBuildHook
62 rustc
63 setuptools
64 setuptools-rust
65 ];
66
67 pythonImportsCheck = [
68 "temporalio"
69 "temporalio.bridge.temporal_sdk_bridge"
70 "temporalio.client"
71 "temporalio.worker"
72 ];
73
74 meta = {
75 description = "Temporal Python SDK";
76 homepage = "https://temporal.io/";
77 changelog = "https://github.com/temporalio/sdk-python/releases/tag/${version}";
78 license = lib.licenses.mit;
79 maintainers = with lib.maintainers; [
80 jpds
81 levigross
82 ];
83 };
84}